Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: rotate a vector with a regex?

by AnomalousMonk (Canon)
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004808]
help
Chatterbox?
[jdporter]: Node=1169071 — Author= — Date=
[jdporter]: [id://1169071<%A]

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-05-23 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?