programming-examples/perl/Subroutine/Using local.pl

16 lines
238 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
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;