in reply to [bugs?] perldoc perlre, \G and pos()
This code
use warnings; $\="\n"; $str = 'ABC'; print "-"x10; print pos($str); pos($str) = 1; while ($str=~/.\G/gc) { print $&; } print pos($str); #__DATA__ # pos($str) = pos($str); while ($str=~/.\G/gc) { print $&; } print "-"x10;
prints:
---------- Use of uninitialized value in print at /home/lanx/B/PL/PM/re_escG.pl l +ine 5. A 1 ----------
but uncommenting line pos($str) = pos($str); prints
---------- Use of uninitialized value in print at /home/lanx/B/PL/PM/re_escG.pl l +ine 5. A 1 A ----------
weird!
Cheers Rolf
|
|---|