Copyright © tutorialspoint.com

PERL reset Function


Syntax

reset EXPR

reset


Definition and Usage

Resets (clears) all package variables starting with the letter range specified by EXPR. Generally only used within a continue block or at the end of a loop. If omitted, resets ?PATTERN? matches.

Variables that have been declared using the my() function will not be reset.

Using reset() can reset system variables you may not want to alter-like the ARGV and ENV variables.

Return Value

  • always 1

Example

Try out following example:

#!/usr/bin/perl -w

my $var = 10;
$van = 5;

print "Var value =$var, Van value =$van\n";
# Now reste all variables who name starts with 'v'
reset('v');
print "Var value =$var, Van value =$van\n";

It will produce following results:

Var value =10, Van value =5
Var value =10, Van value =

Copyright © tutorialspoint.com