in reply to Searching and printing through a array
rsriram,
Change @all[$x] which is an array slice into $all[$x]which is a individual element in an array. The below is equivalent to your code.
If you show the input and output, it is easy to help you out.for my $x (0..$#all) { if($line =~ /$all[$x]/) { print F2 $line; } } simply: foreach (@all) { print F2 $line if $line =~ /$_/; }
Prasad
|
|---|