programming-examples/perl/Subroutine/Passing hash to a subroutine.pl
2019-11-15 12:59:38 +01:00

14 lines
215 B
Perl

$hash{fruit} = peach;
$hash{vegetable} = broccoli;
$hash{pie} = blueberry;
sub printem
{
%hash = @_;
foreach $key (keys %hash) {
print "$key => $hash{$key}\n";
}
}
printem(%hash);