in reply to How do I sort on one of the fields in a dereferenced array reference?

if $row is a reference to an array, then $row->[$i] (where $i is the index) will access a particular list item. for more info, see perlref and perlreftut. also, see perldsc for info on complex data structures.

also, sort won't work inside your for loop, as each row only has one name field. you have to sort all rows, as in my @new_array = sort { @{ $a }->[1] cmp @{ $b }->[1] } @{ $array_ref }; or something close to that.

in this example, i don't see why you're not sorting this data in the database.