use strict; use warnings; my @list; $list[0] = 0; $list[2] = 2; @list = sort {$a <=> $b} @list;