good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: replacing text you have already replaced...by wine (Scribe) |
on Jul 24, 2001 at 22:13 UTC ( [id://99435]=note: print w/replies, xml ) | Need Help?? |
I always use 1 while s///;, but you can also get that behavior with only using s///;:
This outputs a in stead of aaaaaaaaaaaa pos() normally returns the position where the regexpr matched the last time. Normally the s/// operator leaves of at that position. By using pos() as a lvalue you can reset this position. Therefore the s/// operator starts all over, mimmicking the 1 while s///g behavior. I wouldn't use this under normal circumstantions though, since this is kind of a obfu. ;)
In Section
Seekers of Perl Wisdom
|
|