![]() |
|
XP is just a number | |
PerlMonks |
Re^2: Can you assign to pos() in a s/foo/bar/gby johngg (Canon) |
on Oct 25, 2007 at 19:06 UTC ( #647250=note: print w/replies, xml ) | Need Help?? |
Whats wrong with: ... s/(?<=__)(A-Z_)+//g; Nothing (other than not needing the g modifier :-) but as I said, there are a lot of ways to tackle the problem and this particular question piqued my interest. I have tried accessing pos() inside the while loop but I get "Use of uninitialized value" warnings. Doing the same with a match rather than a substitution seems fine and I can even assign to pos() to affect where it matches.
produces
I agree with you, oha's solution is very nice indeed. Thank you for your reply, JohnGG
In Section
Seekers of Perl Wisdom
|
|