my @sorted = sort { my @A = split ':', $a; my @B = split ':', $b; $A[0] <=> $B[0]; } @table; print @sorted;