in reply to rotate a vector with a regex?
... move it pairwise along the string (bubble it).
As I understand it, this won't work because substitution is not being done on the original string during the actual substitution process; rather, an intermediate string is being built up during this process, and the intermediate string is copied to the original string when the process is complete.
That's why something like
($x = $y) =~ s{foo}{bar}xms;
works as it does: instead of copying the intermediate back to the original string ($y), it's copied to another string ($x) leaving the original string untouched. (Or maybe $x is just used as the 'intermediate' in the first place. Whatever...)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: rotate a vector with a regex?
by LanX (Saint) on Nov 21, 2012 at 17:29 UTC |
In Section
Seekers of Perl Wisdom