in reply to Why are lines being skipped in output?
One of the favorite phrases that you'll hear around Perl water-coolers is: TMTOWTDI™ – “There's More Than One Way To Do It.”
This can be both a blessing and a curse.
On the one hand, Perl can do a lot with a little. On the other hand, you can wind up writing an unintended contribution to the (very amusing) section of this site called Obfuscations.
Let your watchword above all be clarity. The computer does not care if you minimize or if you maximize the amount of source-code that you write. It does not care if you include comments or if you omit them. But mark my words, you will, and at the worst possible time. So, make sure that whatever you write, however you write it, is simple and clear and very defensive of possible errors. (“Don't assume” the file will open... Get familiar with die and with the package Carp. Yes, it's much better for your code to croak than to briefly be among the walking-dead.)
Unfortunately, the “DWIM principle” (Do What I Mean...) has been applied to the design of the language and to its implementation. Perl sometimes tries to “guess” what you mean, and to “do ‘it’ anyway,” whatever ‘it’ might mean. This is once-again an argument for simplicity and clarity on your part ... and good documentation. The simpler and easier-to-understand you make your code, the less likely you will be to run into a “feature.”