Name

reset

Synopsis

reset expr

Description

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. expr is 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 expr 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.

Lexical variables (created by my) are not affected. Use of reset is vaguely deprecated.

Get Perl in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.