#!/usr/bin/env perl
#
use strict;
my @someList = ('abc', 'def', 'ghij', 'klm');
my @someOtherList = ('abc', 'def', 'ghij');
#
# to compare the elements of one list with another
#
# 1. method: make a dictionary and check for entries
#
my %someOtherHsh = map { $_ => 1 } @someOtherList;
foreach my $elm (sort @someList)
{
if( ! defined( $someOtherHsh{$elm}))
{
print "$elm is not @someOtherList\n";
}
}
#
# 2. method: use grep
#
foreach my $elm (sort @someList)
{
if( ! grep /$elm/, keys %someOtherHsh)
{
print "$elm is not @someOtherList\n";
}
}