use strict; use warnings; my %hash = ( 5328 => 'High', 26191 => 'Very High', 57491 => 'Low', 4915 => 'High', 1499 => 'Very High', 999 => 'Low', 4323 => 'Average', 4314 => 'High', ); print "$_ => $hash{$_}\n" foreach(sort{$hash{$a} cmp $hash{$b}} keys %hash);