On Wed, Apr 21, 2010 at 1:30 PM, Norman Gaywood <ngaywood@xxxxxxxxxx> wrote: > On Wed, Apr 21, 2010 at 09:21:30AM +0100, Dan Track wrote: >> hashes. It's after this that I'm stuck, I'm struggling to order the >> hash of hashes by uid and then print the ordered list out? Can someone > [snip] >> foreach my $sorted ( sort { $HoH->{$a}{uid} cmp $HoH->{$b}{uid} } keys %HoH) > > cmp is a string comparison. You probably want to sort numerically on the > uid. So replace 'cmp' with '<=>' > > Perhaps that is the problem? > Hi, Thanks for that, although it didn't work at least I think so. foreach my $sorted ( sort { $HoH{$a}->{"uid"} <=> $HoH{$b}->{"uid"} } keys %HoH) { print STDOUT "$HoH{$sorted}\n" } and all I get out is: perl sort.pl HASH(0x89de3d0) HASH(0x8a05d40) HASH(0x8a05dd0) HASH(0x8a05e60) HASH(0x8a05ef0) HASH(0x8a05f80) HASH(0x8a06010) HASH(0x8a060a0) HASH(0x8a06130) HASH(0x8a061c0) HASH(0x8a06250) HASH(0x8a062e0) HASH(0x8a06370) HASH(0x8a06400) HASH(0x8a0fd70) HASH(0x8a0fe90) HASH(0x8a101f0) HASH(0x8a10040) HASH(0x8a10790) HASH(0x8a100d0) HASH(0x8a10160) HASH(0x8a10700) HASH(0x8a10430) HASH(0x8a0ff20) HASH(0x8a10550) HASH(0x8a10310) HASH(0x8a0ffb0) HASH(0x8a103a0) HASH(0x8a0fe00) HASH(0x8a104c0) HASH(0x8a105e0) HASH(0x8a10670) HASH(0x8a10280) Any thoughts on this? Thanks Dan -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines