J
James Willmore
James Willmore <[email protected]> wrote in message news:<[email protected]>...
You need to increment $count each time, or you're going to repeatedly
assign $_ and $first, and none of the others. Is it not possible for
you to test the solutions you propose?
Yes, it is possible for me to test code before posting. However, as
you pointed out, I made a mistake in one of the code snipits. So, I
_always_ put untested before and after the code. Sorry about that.
Next time I'll double check my post before posting - but leave the
"untested" in place in case I make a mistake.
That's a winner, at least.
No, not really. It's an example of how to get lines of a file into an
array - but it has issues that have been pointed out many times on
this newsgroup. As the OP indicated, he wanted to get the first three
lines of a file. This will will accomplish that - and more. So will
the other code examples I posted (minus the errors).
Bottom line - this is covered in perlfaq5, perlopentut, and perhaps a
few other places.
Jim