in reply to Why didn't this sort?

The problem is that you need to sort on the element you want to sort on, not sorting the entire array. If you can explain your sort criteria that would help. Plus, where are you assigning your sort?

I am just guessing, but let's say that you want to sort by the first item, alphabetically, and then the third item numerically. You could do this:

my @sorted = sort { $a->[0] cmp $b->[0] || $a->[2] <=> $b->[2] } @$outputRef;

If you give us a fuller code snippet with desired sort criteria, we can do better than speculate.


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.