At 6:44 PM +0530 1/27/10, V U Maheswara rao k wrote:
Thanks Jhon,
my search string may be more than 100 words like ("warnings", "errors",
"Caution","Debug","notice","info"..etc). so that I want to get it from array
and search it in each line
I want to search a list in a line of file.
Alternation is still the way to go. If you have yours words to search
for in an array (e.g., @words), form your regular expression this way:
my $re = join('|',@words);
Then use it this way:
while(<$fh>) {
if( /$re/o ) {
print;
}
}
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/