use warnings; my @sorted = sort { $a <=> $b } 1, 2, 3, 4; print "@sorted\n";