Perl: the Markov chain saw | |
PerlMonks |
Re: print all data matching identical three alphabets from two different filesby thanos1983 (Parson) |
on Nov 15, 2017 at 16:06 UTC ( [id://1203490]=note: print w/replies, xml ) | Need Help?? |
Hello mao9856, Just to add some minor ideas here on the answer of the fellow monk toolic. I would also add a regex to skip the blank lines with next, where it seems to exist on your file(s) with data. Also I would change the die statements of close file to warn. For me it is not necessary to stop the whole script in case a file can not close but I would like to know it, this is why I would use warn and not die. I would also suggest mao9856 to read this article Don't Open Files in the old way. Sample of code including output based on all the minor modifications:
Hope this helps, BR. Update: Thanks to fellow monk Laurent_R for noticing a typo I have update the sample of code.
Seeking for Perl wisdom...on the process of learning...not there...yet!
In Section
Seekers of Perl Wisdom
|
|