on my unix box.$lines = `/usr/bin/wc -l afile.txt`; open(F, '<afile.txt') || die 'cannot open afile.txt'; $cntr = 0; while (<F>) { $cntr++; print; last if $cntr == $lines - 2; }
In reply to Re: Print all lines in a file except the last two
by mifflin
in thread Print all lines in a file except the last two
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |