Oops...... I made some mistake, sorry =)
should be like this :

###########################
open (FILE, "<file.txt");
while (<FILE>) 
{
    @lineNumber = (@lineNumber, $count) if ($_ eq "apple\n") ;
    $count++;
}
close (FILE);
###########################

PS. if you have only 1 apple, then it valued at $lineNumber[0];

have a nice day =)


----- Original Message ----- 
From: "Mark Mclogan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001 5:36 AM
Subject: Question!! number of line....


> 
> How I can know in that I number of line finds a word in a text file?.
> For example, a file "file.txt" contains the following list:
> 
> Chocolate
> Cake
> Cheese
> Apple
> orange
> melon
> lemon
> 
> How I can know in that line number is the Apple word?
> 
> Over
> 
> MMClogan
> 
> 
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to