Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: reset of match variables

by Corion (Pope)
on Oct 03, 2011 at 14:40 UTC ( #929355=note: print w/ replies, xml ) Need Help??


in reply to reset of match variables

You can't reset them without doing a new match, but you can easily check whether there was a match:

perl -ne '/$regex/ and $SUM += $1; END { print $SUM }' file.txt


Comment on Re: reset of match variables
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-31 07:40 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 (275 votes), past polls