----- Original Message -----
From: "Mark Mclogan" <[EMAIL PROTECTED]>
> 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?
open FILE, 'file.txt' or die "$!\n";
while (<FILE>){
chomp;
my $count++;
print "Apple is found in line number $count\n" if (/Apple/);
};
close FILE;
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]