#!/usr/bin/perl use strict; use List::Compare; my @temp = ( 'test', 'test1', 'test', 'test2', 'test2', 'test' ); print "----------------------\nContents of Temp Array\n"; print "\t", $_, "\n" foreach (@temp); my @temp2 = ( 'test1', 'test2', 'test2' ); print "----------------------\nContents of Temp2 Array\n"; print "\t", $_, "\n" foreach (@temp2); my $lc = List::Compare->new('--unsorted', \@temp, \@temp2); my @intersection = $lc->get_intersection; print "----------------------\nThe (Unique) Intersection of Temp and Temp2 Arrays\n"; print "\t", $_, "\n" foreach (@intersection); exit;