reset
EXPR
reset
This function is generally used at the top of a loop or in a
continue
block at the end of a loop, to clear global variables or reset
??
searches so that they work again. The expression is interpreted as a list of single characters (hyphens are allowed for ranges). All scalar variables, arrays, and hashes beginning with one of those letters are reset to their pristine state. If the expression is omitted, one-match searches (
?
PATTERN
?
) are reset to match again. The function resets variables or searches for the current package only. It always returns 1.
To reset all "
X
" variables, say this:
reset 'X';
To reset all lowercase variables, say this:
reset 'a-z';
Lastly, to just reset
??
searches, say:
reset;
Note that resetting "
A-Z
" is not recommended since you'll wipe out your
ARGV
,
INC
,
ENV
, and
SIG
arrays.
Lexical variables (created by my ) are not affected. Use of reset is vaguely deprecated.