Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: output differs in perl version

by Neighbour (Friar)
on Jul 04, 2011 at 11:33 UTC ( #912630=note: print w/replies, xml ) Need Help??

in reply to Re: output differs in perl version
in thread output differs in perl version

But you always can implement the algorithm in a way that does work in 5.8.8. For example like this:
while ( $str1 =~ /^(\S+\s+)(\S+\s+\S+)(.*)$/ ) { print "$1$2\n"; $str1 = "$2$3"; $n++; }

Alternatively, you could use $' (${^POSTMATCH} doesn't work in 5.8.8):
while ( $str1 =~ /^(\S+\s+)(\S+\s+\S+)/ ) { print "$1$2\n"; $str1 = "$2$'"; $n++; }

Replies are listed 'Best First'.
Re^3: output differs in perl version
by ikegami (Pope) on Jul 05, 2011 at 02:00 UTC

    Doesn't work.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2016-10-28 03:46 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (375 votes). Check out past polls.