# sort a list of arrayrefs by index 2 of each member array @sorted = sort { $a->[2] <=> $b->[2] } @arraylist; # sort a list of hashrefs by key 'key' of each member hash @sorted = sort { $a->{key} <=> $b->{key} } @hashlist;