foreach my $key(%count){ my $c = $key; my $c1 = $count{$key}; print "$c = $c1\n"; # Or more directly, print "$key = $count{$key}\n"; }