How does one move down a line in a file?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top