in reply to sort by a multiple columns

This is really ugly (maybe someone could improve it with pack/unpack), but it reproduces your desired output:
#!perl use strict; use warnings; my @un_sorted = ( [3, 4, 23, 4, 5], [3, 4, 56, 2, 4], [2, 3, 43, 5, 3], [2, 3, 43, 6], [3, 4] ); my $end = chr(1e6); print join "\n", map { join ',', @$_ } map { splice @$_, $#_; $_ } map { [(map(ord, split('', $_)))]} sort map { join('', map chr, @$_) . $end } @un_sorted;
It's a GRT (kinda, probably not the best performance, though). The trick with the end marker is especially ugly, but without it the output would be wrong.
Hope this helped.
CombatSquirrel.

Entropy is the tendency of everything going to hell.