<$foo> reads from the file. So you're reading the first line in the file, then in print reading another one and printing it. Try using $_ instead.
For clarity sake, especially in situations where speed is not as important, it's best to say something like:
while (my $line = <foo>) { print $line, "\n"; }
The code is a bit more self-explanatory to Perl newbies (and sleep/food-deprived programmers) and is less likely to be buggy if you start using things like grep that twiddle with the value of $_.
In reply to Re: help with
by rrwo
in thread help with the diamond operator
by La12
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |