You want a custom
sort function. Assuming you have a list of lists in
@record, the following would do the job:
my @sorted = sort { $a->[2] cmp $b->[2] || $b->[1] <=> $a->[1] } @record;
It uses
cmp on to compare the third elements of each record, and if they turn out to be identical, uses
<=> to compare the second elements of each record in reverse order.
Makeshifts last the longest.