Mega Code Archive

 
Categories / Perl / Hash
 

Using while and each function to output value in a hash

$hash{fruit} = orange; $hash{sandwich} = club; $hash{drink} = lemonade; while(($key, $value) = each(%hash)) {     print "$key => $value\n"; }