Using cmp in array sort customized function
#!/usr/bin/perl -w use strict; my @unsorted = (1, 2, 11, 24, 3, 36, 40, 4); my @string = sort { $a cmp $b } @unsorted; print "String sort: @string\n";