Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 imbibing at the Monastery: (12)
As of 2014-09-19 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (145 votes), past polls