programming-examples/perl/Hash/each function returns both key and value in a hash.pl
2019-11-15 12:59:38 +01:00

7 lines
147 B
Perl

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