local
- local EXPR
You really probably want to be using
my
instead, becauselocal
isn't what most people think of as "local". See Private Variables via my() in perlsub for details.A local modifies the listed variables to be local to the enclosing block, file, or eval. If more than one value is listed, the list must be placed in parentheses. See Temporary Values via local() in perlsub for details, including issues with tied arrays and hashes.
The
delete local EXPR
construct can also be used to localize the deletion of array/hash elements to the current block. See Localized deletion of elements of composite types in perlsub.