Another way to do it is to use Array::Utils
use Array::Utils qw(:all);
my @a = qw( a b c d );
my @b = qw( c d e f );
# symmetric difference
my @diff = array_diff(@a, @b);
# intersection
my @isect = intersect(@a, @b);
# unique union
my @unique = unique(@a, @b);
# check if arrays contain same members
if ( !array_diff(@a, @b) ) {
# do something
}
# get items from array @a that are not in array @b
my @minus = array_minus( @a, @b );
What is the difference between "let" and "var"?
How do I replace all occurrences of a string?
How to randomize (shuffle) a JavaScript array?
How do I format a date in JavaScript?
How can I get query string values in JavaScript?
How to access the correct `this` inside a callback
How do I check if a directory exists? "is_dir", "file_exists" or both?
How to create an array from a CSV file using PHP