my @c = (1..20); for ($i = 0; $i <= $#c; $i++) { if ($c[$i] >= 5 && $c[$i] <= 10) { splice(@c,$i,1); $i--; } } print join ' ', @c;