The following example shows how to display the key value pairs from a hash using the perl foreach feature:

Code:
#!/usr/bin/perl

use warnings;
use strict;

$\="\n";

my %h1=(Jan => 31, Feb => 28, Mar => 31);

foreach my $key (keys%h1) {
        print "$key => $h1{$key} ";