programming-examples/perl/Subroutine/Passing hash to a subroutine.pl

14 lines
215 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$hash{fruit} = peach;
$hash{vegetable} = broccoli;
$hash{pie} = blueberry;
sub printem
{
%hash = @_;
foreach $key (keys %hash) {
print "$key => $hash{$key}\n";
}
}
printem(%hash);