in reply to Creating a two dimensional array and sorting by index

Try this, the real trick only takes one line:
use strict; my $AoA = [[1, "apple"], [4, "pear"], [2, "plum"], [3, "orange"]]; print join("|", map {$_->[1]} sort {$a->[0] <=> $b->[0]} @{$AoA});