my @array = (0,1,2,3,4,5); @array = grep {$_ % 3} @array; #replace $_%3 with whatever condition applies. print @array;