http://www.perlmonks.org?node_id=205991

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I have two arrays that look like this:

@array1= 1 83 90 120 140 300

@array2= 83 140

I want to delete all the values in array2 out of array1 so array 1 looks like this:

@array1= 1 90 120 300

I have tried using for loops to iterate through the arrays:

for (my $search =0; $search<scalar @array1; $search++) { for ($search2 =0; $search2<scalar @array2; $search2++) { if($array1[$search] eq $array[$search2]) { this is where I want to do something that deletes the appr +opriate value from array1 } else { carry on as usual, no deletions }
I tried using undef to delete, and I know unshift/shift/pop/push only work at the start and end of arrays.

Any suggestions, Thanks