sub sort_hash { my %hash = @_; #do the sorting part here, please help :) return %hash; } my %foo_sorted = sort_hash(%foo); print "$foo_sorted{$_}\n" foreach keys %foo_sorted;