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
In reply to Re: reset of match variables
by Corion
in thread reset of match variables
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |