rsriram has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I am searching through a text file to find out if any elements of the array are present in the line. If found, it has to be printed to a file. I used the following code
for ($x=0; $x <= $#all; $x++) { if($line =~ /@all[$x]/g) { print F2 $line; }
In the output, I get only value of @all[$x]. I need to print the complete line. Can anyone help me out?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching and printing through a array
by Corion (Patriarch) on Mar 13, 2007 at 09:41 UTC | |
|
Re: Searching and printing through a array
by davorg (Chancellor) on Mar 13, 2007 at 09:46 UTC | |
|
Re: Searching and printing through a array
by prasadbabu (Prior) on Mar 13, 2007 at 09:46 UTC |