in reply to Re: HoH Sorting by value
in thread HoH Sorting by value

Your data structure doesn't look right to me, unless you really want to have multiple employee_numbers per ss_number.

Probably you want a hash with ss_number as the key and the value as either an array ref or hash ref with all the values associated with that ss_number. E.g.

$myhash{'555236801'} = [3035, 2]; or $myhash{'555236801'} = { empno => 3035, years => 2 };
Anyway, one easy way to get what you want is like this (at least on Unix (using the latter data structure:
open SORTEDOUT, "|sort +2" or die "cannot open sort: $!\n"; for (keys %myhash) { print SORTEDOUT $_, " ", $myhash{$_}{empno}, " ", $myhash{$_}{year +s}, "\n"; } close (SORTEDOUT) or die "Error on sort: $!\n";