No such thing as a small change | |
PerlMonks |
Re: problem in loopingby aitap (Curate) |
on Aug 13, 2012 at 23:35 UTC ( [id://987240]=note: print w/replies, xml ) | Need Help?? |
First of all, use warnings and strict if your script is longer than several lines. It is really a good practice which will help you to avoid many errors. Secondly, it is recommended to use more modern and more safe three-argument form of open, using scalar variables as filehandles: You can even use autodie to skip writing those checks. You can also pass file names as command-line arguments. Thirdly, you can process both files in one while loop, if you want to just check the data of the same line numbers:
Fourthly, remember: indenting is your friend. It helps to understand the structure if your program. Run your code through Perl::Tidy, set up your editor to indent the text for you, or install the Perl IDE. Note: the code samples are untested and may fail for some reason.
Sorry if my advice was wrong.
In Section
Seekers of Perl Wisdom
|
|