in reply to Sorting an Array of Hashes (AoH) by its keys as a threaded message

Sound like you want to sort by parent and then by message ID. Something like this will work:

my @sorted = sort { $a->{parent} <=> $b->{parent} || $a->{messageId} <=> $b->{messageId} } @$testarray; foreach (@sorted) { print "$_->{messageId}\t$_->{parent}\n"; }
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re: Sorting an Array of Hashes (AoH) by its keys as a threaded message
  • Download Code