#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array = ("world", "today", "is nice"); my %hash = ( 0 => "Hello", 1 => "world", 2 => "today", 3 => "is" , 4 => "nice" ); my @hashValues = values %hash; print Dumper \@hashValues; use List::Compare; my $lc = List::Compare->new(\@hashValues, \@array); my @intersection = $lc->get_intersection; my @union = $lc->get_union; print Dumper \@intersection; __END__ Monks$ perl test.pl $VAR1 = [ 'nice', 'Hello', 'today', 'world', 'is' ]; $VAR1 = [ 'today', 'world' ];