In article <E13Unhe-0000uo-00@draco.cus.cam.ac.uk>, Mike Guy <mjtg@cam.ac.uk> wrote: > There seem to be funny scoping effects with pos(): > > #perl -wl > $x = 'a' x 200 . 'b'; > { $x =~ /b/g; }; > print pos $x; > { $x =~ /b/g; $y = pos $x }; > print "$y ", pos $x; > print do { $x =~ /b/g; pos $x }; > __END__ > 201 > Use of uninitialized value in concatenation (.) or string at - line 5. > Use of uninitialized value in print at - line 5. > > 201 Nothing to do with scoping. The second match fails (only one b in $x). [D:\home\sthoenna]perl -wl $x = ('a'x200).'b'; $x =~ /b/g; print pos $x; $x =~ /b/g; print pos $x; $x =~ /b/g; print pos $x; __END__ 201 Use of uninitialized value in print at - line 3. 201Thread Previous | Thread Next