sub sortBySite { my ($site_a) = keys %{$tmp{$a}{'priority'}}; my ($site_b) = keys %{$tmp{$b}{'priority'}}; return $site_a cmp $site_b; }