programming-examples/perl/Subroutine/Using closures.pl
2019-11-15 12:59:38 +01:00

11 lines
222 B
Perl

#!/usr/bin/perl
sub errorMsg {
my $lvl = shift;
return sub {
my $msg = shift;
print "Err Level $lvl:$msg\n";
};
}
$severe = errorMsg("Severe");
&$severe("Divide by zero");