my @toRemove; foreach my $item ( (@array1, @array2) ) { if ( $item =~ /$pattern/i ) { push(@toRemove, $item); } } foreach my $item ( @toRemove ) { @array1 = grep { $_ ne $item } @array1; } #### my @toRemove = grep m/$pattern/i, @array1, @array2; my %toRemove = map { ($_ => 1) } @toRemove; @array1 = grep ! $toRemove{$_}, @array1; #### @array1 = grep ! m/$pattern/i, @array1; #### splice @array,7,1;
## my @toRemove = grep m/$pattern/i, @array1, @array2; my %toRemove = map { ($_ => 1) } @toRemove; @array1 = grep ! $toRemove{$_}, @array1; ##
## @array1 = grep ! m/$pattern/i, @array1; ##
## splice @array,7,1;