Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

by tye (Sage)
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        

Replies are listed 'Best First'.
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 .

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004979]
talexb concurs .. almost 16 years here.
[TStanley]: Time flies when you're busy :D
LanX hasn't entered monk puberty yet
erix clocks 12 years
[TStanley]: talexb I was actually in your area last week. I was working in Milton, Ontario at the hospital they are building there.
Eily hasn't entered monk school

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2017-06-23 13:55 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (547 votes). Check out past polls.