vitoco has asked for the wisdom of the Perl Monks concerning the following question:
Im quite embarrassed, but I cannot figure out what's going on here:
#!perl use strict; use warnings; my $data = <DATA>; chomp $data; my @f = ($data =~ m!((\w+),+)+!g); print join("\t", @f) . "\n"; __DATA__ qwerty,asd,zxcvbnm,fgh,jkl,uiop,
Output:
uiop, uiop
I was expecting to receive many elements in the array: every word twice (one with and one without the comma), not just the last one.
What am I missing?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Iterations in regex
by toolic (Bishop) on May 12, 2014 at 15:44 UTC | |
Re: Iterations in regex
by LanX (Saint) on May 12, 2014 at 16:08 UTC | |
by vitoco (Hermit) on May 12, 2014 at 17:02 UTC |
Back to
Seekers of Perl Wisdom