programming-examples/perl/Subroutine/Return hash value from subroutine.pl
2019-11-15 12:59:38 +01:00

15 lines
229 B
Perl

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