Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Requiring backtracking a certain number of times

by ferrency (Deacon)
on Apr 04, 2002 at 18:24 UTC ( [id://156726]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Requiring backtracking a certain number of times
in thread Requiring backtracking a certain number of times

I went down this same track, and came up with a version that doesn't munge $_:

s/(\d)/$s+=$1,$1/ge;
Although I was hampered by the fact that this doesn't work in psh for some reason.

Alan

Replies are listed 'Best First'.
Re4: Requiring backtracking a certain number of times
by dragonchild (Archbishop) on Apr 04, 2002 at 19:06 UTC
    After playing, I came up with:
    @a=/.(?{$s+=$&})/g;
    However, I have to have the @a=. If you run it without that, it only deals with the first number. *blinkblink* That's just so counter-intuitive.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found