Return hash value from subroutine : Return « Subroutine « Perl
- Perl
- Subroutine
- Return
Return hash value from subroutine
sub gethash ()
{
$hash{fruit} = peach;
$hash{vegetable} = broccoli;
$hash{pie} = blueberry;
return %hash;
}
%myhash = gethash;
foreach $key (keys %myhash) {
print "$key => $myhash{$key}\n";
}
Related examples in the same category