use warnings; use strict; use feature 'say'; my @a = (1, 2, 3, 4, 3, 5, 3); my @find = (3, 4); for my $find (@find){ while (my ($index) = grep { $a[$_] eq $find } 0..$#a){ splice @a, $index, 1; } } say $_ for @a; __END__ 1 2 5