in reply to removing elements in array in perl

If you wanted to remove any element in A2 from A1, which might appear in any order. I would convert @A2 to a hash and use grep.
#!/usr/bin/perl use strict; use warnings; my @A1= qw/0 1 6 2 3 7 4 5/; my @A2= qw/6 7/; my %hash = map {$_ => 1}@A2; @A1 = grep {!defined $hash{$_}}@A1; print "@A1\n"; #prints: 0 1 2 3 4 5