Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read file line by line

Status
Not open for further replies.
Apr 30, 2003
56
US
I have a file that I don't know how many lines are in the file. Does perl has read line function that can read the file line by line until the end of the file? What is the syntax like? Please help me on this. Thanks.
 
hi eileen

while(<>){
$line_count ++;
}
print $line_count;

put that in a script and feed its STDIN with the file

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top