in reply to Bizarreness in ?PATTERN? and g
with this:$s="a1 a2 a3"; for (1..2) { print $1 if $s =~ ?a(\d+)?g; }
I would expect these to be equivalent ... but no, the first example prints "1" and the second prints "1 2".$s="a1 a2 a3"; print $1 if $s =~ ?a(\d+)?g; print $1 if $s =~ ?a(\d+)?g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bizarreness in ?PATTERN? and g
by CountZero (Bishop) on Jun 04, 2004 at 05:50 UTC | |
|
Re^2: Bizarreness in ?PATTERN? and g
by revdiablo (Prior) on Jun 04, 2004 at 05:45 UTC | |
by ysth (Canon) on Jun 04, 2004 at 07:15 UTC | |
by beth (Scribe) on Jun 04, 2004 at 18:20 UTC |