Reference:
http://alvinalexander.com/blog/post/perl/how-print-values-items-elements-perl-hash
#!/usr/bin/perl
# create our perl hash
$prices{"pizza"} = 12.00;
$prices{"coke"} = 1.25;
$prices{"sandwich"} = 3.00;
while (($key, $value) = each (%prices))
{
print "$key costs $prices{$key}\n";
}
沒有留言:
張貼留言