Hi Friends,
I am writing a script to compare two files put in two arrays and I expect the those elements which are found in array2 that are not in array1. here there are 2 files Perf.txt which contains some names, and Neu.txt contains some names which are common as well as some different names. Now I am interested only in different names that are not present in Perf.txt
My script:
open (PERF, "Perf.txt");
open (DSA, "Neu.txt");
@Perf = <PERF>;
@Neu = <DSA>;
my %seen; # lookup table
# build lookup table
@seen{@Neu} = ();
foreach $item (@Perf)
{
# print ($item) unless exists $seen{$item};
push (@miss, $item) unless exists $seen{$item};
}
foreach(@miss)
{
print "\nElement found ---> $_";
}
When I execute this I am getting all the names which are present in Neu.txt.
Please suggest me what I am wrong.
Thanks and Regards,
Raghavendra S