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


in reply to Finding wether all elements of one array are in another

Hi tsk1979 ,

There is a module List::Compare will do that work.

use strict; use warnings; use List::Compare; my @a = qw(-true -depth=1); my @b = qw(-search -depth=1 -true -expand_all) ; my $lc = List::Compare->new( \@a, \@b ); my @a_only = $lc->get_Lonly; my @b_only = $lc->get_Ronly; print join( ', ', @a_only ), "\n"; # 1, 2 @a_only ? print "@a_only" : print "\nAll Matched";