Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It sounds like to me that you haven't tried any of the things in the Perl book that might answer this question. You do have a Perl book, don't you? I can highly recommend the fine series of books from O'Reilly. In any event, the variable $. tells you what line you're on, so printing that out after reading through the file would tell you what number the last line of the file was.
If you also want to fine out how many characters there were, you'd add something to count the length of each line:
I haven't tested this code; don't know if it works or not. I'll leave that up to you. Play around. See what works. Read that Perl book. Try stuff, and come ask questions when you get stuck, and not before. Alex / talexb / Toronto Life is short: get busy! In reply to Re: Count the number of lines in a file
by talexb
|
|