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

Re^2: rotate a vector with a regex? (//g, s/\G)

by tye (Cardinal)
on Nov 21, 2012 at 18:13 UTC ( #1004979=note: print w/ replies, xml ) Need Help??


in reply to Re: rotate a vector with a regex?
in thread rotate a vector with a regex?

local $_ = '12345'; while( /(?=..)/g ) { my $pos = pos(); s/\G(.)(.)/$2$1/; pos() = $pos + length($2); } print $_, $/ __END__ 23451

- tye        


Comment on Re^2: rotate a vector with a regex? (//g, s/\G)
Download Code
Re^3: rotate a vector with a regex? (//g, s/\G)
by remiah (Hermit) on Nov 22, 2012 at 10:15 UTC

    Hello tye. Thanks for reply

    zero width look ahead and \G .
    fine!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (20)
As of 2015-07-02 12:44 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 (36 votes), past polls