Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 exploiting the Monastery: (15)
As of 2014-12-17 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (34 votes), past polls