Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: rotate a vector with a regex?

by AnomalousMonk (Abbot)
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 studying the Monastery: (18)
As of 2015-07-02 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls