You could always try something like this:
while(<INFILE>) { if(/$realname/) { print OUTFILE; $count++; } } $count should have the number of lines at the end. -----Original Message----- From: Tim Lago To: [EMAIL PROTECTED] Sent: 2/19/02 6:30 AM Subject: How to count lines in an output file I've written a really simple script that opens a file, reads for specific line of text and copies the matches to an output file, Here it is: open(INFILE, "rmaccess1.txt"); open(OUTFILE, ">outfile.txt"); print "Enter the name of the Media file to analyze and press Enter: \n"; chomp($realname = <STDIN>); while(<INFILE>) { if(/$realname/) { print OUTFILE; } } Now, I want to add another line that counts the number of lines that were created in the outfile.txt, any help? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]