printf "%-12s %s\n", $_, $birthdays{$_} for grep { $birthdays{$_} } sort keys %birthdays; #### $ perl test.pl Name Birthday ------------------------- Bob August 28 Fred June 1 Glenn May 27 Ray May 31