Hello Avinash,
yes u can easily find the word and its line through regx. here i have
just given a simple example to your reference.
im also preparing the perl and working in small tasks. keep in touch
regarding any perl related discussion.
#usr/bin/perl
use warnings;
open(my $sen, "<", "input.txt") or die "cant open input.txt";
my @list = <$sen>;
my $txt;
close $sen;
foreach (@list) {
if ($_ =~ /gmail/) {
open($txt, ">> utxt.txt") or die "Can't open input.txt:";
print $txt $_;
close $txt;
}
}
Thanks,
K. Senthil Kumar
-----Original Message-----
From: Perl_Official@yahoogroups.com
[mailto:Perl_Official@yahoogroups.com]On Behalf Of avinash k
Sent: Wednesday, September 05, 2007 4:56 PM
To: Perl_Official@yahoogroups.com
Subject: [Perl] How to search particular words in a file
hi,
I am trying to find particular words in text files(i.e. *.txt files)
Should i use regular expressions in doing?
Thanks in advance
Avinash
---------------------------------
Get the freedom to save as many mails as you wish. Click here to know how.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]