#all the checks have been run - now sort the 2 hashes, and print out their contents to the note. my $ReleventCount = scalar keys %Relevent; if ($ReleventCount >= 1) { foreach my $name (sort { $b <=> $a } keys %Relevant) { $RESULTS = $RESULTS . "Severity: " . $name . "\n" . $Relevent{$name} . "\n\n" } }