in reply to Simple Hash Question

The keys of the hash are what you want to print out. If I understand your difficulty, all you need to do to get your desired result it to use $key in place of $hash{$key} in your print statement, i.e.

#!/usr/bin/perl use strict; use warnings; my $count = 1; my @array = ('A','B','C'); my %hash = (); for my $i (@array) { # set key AND initialize by $count as value of key. $hash{$i} = $count; $count++; } for my $key ( sort {$hash{$a} <=> $hash{$b} } keys %hash ) { print " MIRACLE_HAPPENS is equal to $key.<br>\n"; }