Check out the module List::Compare.
#copied from the documentation
use List::Compare;
my @Llist = qw(abel abel baker camera delta edward fargo golfer);
my @Rlist = qw(baker camera delta delta edward fargo golfer hilton);
my $lc = List::Compare->new(\@Llist, \@Rlist);
#get_unique()
#Get those items which appear (at least once) only in the first list.
@Lonly = $lc->get_unique;
@Lonly = $lc->get_Lonly; # alias
#get_complement()
#Get those items which appear (at least once) only in the second list.
@Ronly = $lc->get_complement;
@Ronly = $lc->get_Ronly; # alias