@sorted = sort {$a[1] <=> $b[1]} @array; # use {$b[1] <=> $a[1]} for a reversed sort # or {$a[0] cmp $b[0]} to sort by filenames