use strict; my @data = (1,2,3,4,5,6,7,8,9,10); my (@temp) = (@data); # copy array into a temporary array undef @data; # wipeout initial array foreach my $item (@temp) { if ($item !~ m/4/) { # if the element's value is not 4 push @data, ($item); # copy it back into the array } # otherwise do nothing }