Mega Code Archive

 
Categories / Perl / Statement
 

Use foreach to loop through hash with keys function

$hash{sandwich} = ham; $hash{drink} = 'AA'; foreach $key (keys %hash) {     print $hash{$key} . "\n"; }