in reply to Sorting sorts 13 as less than 2

You're doing an alphabetical sort. Sort numerically using

@sorted = sort { $a <=> $b } @unsorted;

See the perlop manpage for details.

Cheers, Flo