Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent pos() after scalar m//gc vs. list m//gc in 5.5.3 #759

Closed
p5pRT opened this issue Oct 21, 1999 · 3 comments
Closed

inconsistent pos() after scalar m//gc vs. list m//gc in 5.5.3 #759

p5pRT opened this issue Oct 21, 1999 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 21, 1999

Migrated from rt.perl.org#1683 (status was 'resolved')

Searchable as RT1683$

@p5pRT
Copy link
Author

p5pRT commented Oct 21, 1999

From @RandalSchwartz

# 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!

@p5pRT
Copy link
Author

p5pRT commented Aug 7, 2002

From @gbarr

Fixed in 5.8.0

@p5pRT
Copy link
Author

p5pRT commented Aug 7, 2002

@gbarr - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant