Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: searching string from one file in anotherby Eily (Monsignor) |
on Feb 28, 2017 at 13:35 UTC ( [id://1183141]=note: print w/replies, xml ) | Need Help?? |
++ on the bad variable names. The fact that the variables have numbers is a first sign that the names are probably not well chosen, but having two variables with the same names (a hash and a scalar named file2) should absolutely be avoided. Your proposition works fine if the lines in $data are unique, (the fact that they are counted using $file2{$line}++ makes me think they may not be) but will print duplicates otherwise.
In Section
Seekers of Perl Wisdom
|
|