@array = (1..10); for(my $i=0; $i<@array; $i++) { if($array[$i]%2) { splice(@array,$i,1,()); $i-- #array is one shorter, now; } } print "@array\n";