Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: rotate a vector with a regex?

by AnomalousMonk (Monsignor)
on Nov 20, 2012 at 22:08 UTC ( #1004808=note: print w/ replies, xml ) Need Help??


in reply to rotate a vector with a regex?

s/(.)(?=.)/$2$1/g;
...
... produced 5 warnings and left the string unchanged (I presume the warnings were that $2 was undef)..

Yes, because there is no capture group 2 ((?=.) is a non-capturing look-ahead) and the first capture group is being replaced with itself: $1.


Comment on Re: rotate a vector with a regex?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004808]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2014-08-22 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (163 votes), past polls