Closed p5pRT closed 22 years ago
# I expect this: pos = 2; @words = (); push @words\, $1 while /\G\s*(\w+)/g; print "scalar g (@words) = "\, defined pos() ? pos() : "undef"\, "\n"; # "ed barney"\, respected initial pos\, pos is undef at end
# I expect this: pos = 2; @words = (); @words = /\G\s*(\w+)/g; print "list g (@words) = "\, defined pos() ? pos() : "undef"\, "\n"; # "ed barney"\, respected initial pos\, pos is undef at end
# I expect this: pos = 2; @words = (); push @words\, $1 while /\G\s*(\w+)/gc; print "scalar g (@words) = "\, defined pos() ? pos() : "undef"\, "\n"; # "ed barney"\, respected initial pos\, pos is 11 at end
# I think this is a bug: pos = 2; @words = (); @words = /\G\s*(\w+)/gc; print "scalar g (@words) = "\, defined pos() ? pos() : "undef"\, "\n"; # "ed barney"\, respected initial pos\, but pos is still 2??? __END__
From my read of the docs\, I think pos() should be left at the end of the last successful match if /c is present. Any takers? Anyone got a patch? Either the docs or the behavior is off here.
-- Randal L. Schwartz - Stonehenge Consulting Services\, Inc. - +1 503 777 0095 \merlyn@​stonehenge\.com \<URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting\, Technical writing\, Comedy\, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Fixed in 5.8.0
@gbarr - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#1683 (status was 'resolved')
Searchable as RT1683$