Using local : Local « Subroutine « Perl
- Perl
- Subroutine
- Local
Using local
sub printifOK
{
local $localvalue = $value;
if ($localvalue > 10 ) {
print "Value is $value.\n";
} else {
print "Value is too small.\n";
}
}
$value = 10;
printifOK;
$value = 12;
printifOK;
Related examples in the same category