I have two arrays, @a and @b. I want to do a compare among the elements of the two arrays.
@a
@b
my @a = qw\"abc def efg ghy klm ghn\"; m
my @a = qw' abc def efg ghy klm ghn '; my @b = qw' def ghy jgk lom com klm '; my $flag; foreach my $item(@a) { $flag = @b~~$item ? 0 : 1; last if !$flag; }
Note that you will need Perl 5.10, or later, to use the smart match operator (~~) .
~~