Re: sorting hash numerically

2003-02-04 Thread Pete Emerson
perldoc -q sort foreach $empNo (sort {$a<=>$b} keys %empName) { On Tue, 2003-02-04 at 08:17, Rob wrote: > Hi, I want to sort a hash based on the employee number; I used a foreach > loop but it sorts the hash based on the ascii value. How would I get it > to sort on integer values? -- To unsu

sorting hash numerically

2003-02-04 Thread Rob
Hi, I want to sort a hash based on the employee number; I used a foreach loop but it sorts the hash based on the ascii value. How would I get it to sort on integer values? foreach $empNo (sort (keys(%empName))) { print "$empNo $empName{$empNo}\n"; } -- Rob -- To unsubscribe, e-mail: [E