I am new to Perl and trying to learn it. I have two files, ‘file1’ and ‘file2’, I need to find which symbols in ‘file1’ are not in ‘file2’ for companyA and departments B and C.
File1
GTY
TTY
UJK
TRE
File2
departmentA_companyA.try=675 UJK 88 KKR
departmentA_companyB.try=878 UJK 37 TAR
departmentA_companyC.try=764 UJK 92 PAM
departmentB_companyA.try=675 UJK 88 KKR
departmentB_companyB.try=878 UJK 37 TAR
departmentB_companyC.try=764 UJK 92 PAM
departmentC_companyA.try=675 UJK 88 KKR
departmentC_companyB.try=878 UJK 37 TAR
departmentC_companyC.try=764 UJK 92 PAM
In this case, I’d suggest you use the keys of a hash to store this list (
$symbols{$symbol} = 1;). This is because it’s easy and cheap to delete from a hash (delete $symbols{$symbol};).Spoiler: