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; #### ---------- Use of uninitialized value in print at /home/lanx/B/PL/PM/re_escG.pl line 5. A 1 ---------- #### ---------- Use of uninitialized value in print at /home/lanx/B/PL/PM/re_escG.pl line 5. A 1 A ----------