Mega Code Archive

 
Categories / Perl / Hash
 

Each function returns both key and value in a hash

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