|We don't bite newbies here... much|
Re: find common data in multiple filesby Discipulus (Monsignor)
|on Dec 28, 2017 at 10:20 UTC||Need Help??|
Have you run the code you posted? @counts and even more open my A, "<", "@counts "could not open file1 $!"; make no sense at all. Also foreach (@ARGV) makes no sense infact you are never using $_ the implicit variable filled for you by foreach when you do not specify a named variable.
So the beginning of your program must be better wrote as:
Use print to debug your program: print "DEBUG: working on file [$_]\n" as first line of the loop will confirm you are reading all files.
Then you do not need to split you lines as you want to check for ID121 ABC14 whole presence in every file. So put the whole line as key of the results hash and ++ it as you are doing.
A tip: as you need only strings that are in all files add every entry of the first file and then for following files just ++ keys that are already present in the hash.
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.