I have been trying to sort a hash but I cannot figure it out for the life of me
The hash is in the form: my %message { messageid { From => To => To_Num => 'Int' Sub_IP => Subject => } } Right now my sort is looking like foreach (sort {$message{$_}->{'To_Num'}[$a] <=> $message{$_}->{'To_Num'}[$b]} keys (%message)) { } I know it doesn't work, and I'm not sure if that's the proper way to do it, maybe you guys could give me a little insight On second thought $_ is not initialized yet in the foreach loop, possibly: foreach (sort {$message{$a} cmp $message{$b}} keys (%message)) { foreach (sort {$message{$_}->{'To_Num'}[$a] <=> $message{$_}->{'To_Num'}[$b]} keys (%message)) { } } Thanks,