in reply to Howto Compare 2 lists

Have you looked at the Q&A section on arrays? There are a number of variations that may be interesting.

You can use grep to find the members of list_a that are not members of list_b all in the same line of code.

my @list_a = qw (3 1 2 5 4); my @list_b = qw (5 3 6 2 7 1 4); my @list_c = grep {my $x=$_; !grep {$x==$_} @list_a} @list_b; print "@list_c";
The use of multiple greps is expensive where @list_a is larger than a few elements. A hash lookup would be preferred.