On 11/29/05, Charles K. Clarkson <[EMAIL PROTECTED]> wrote:
>
> Muthukumar <mailto:[EMAIL PROTECTED]> wrote:
>
>
>    No, I don't think so.
>
>    Let's test it. We'll assume that <FD> has 3 lines in it.
> On the first pass of the outer loop we load the first value
> from "file1." We then compare it to each value in "file2."
> Fine so far.
>
>     On the second pass of the outer loop we load the second
> value from "file1." But FD1 is at the end of the file, so
> there is nothing to compare the second value to.
>
>     On the third pass of the outer loop we load the third
> value from "file1." But FD1 is at the end of the file, so
> there is nothing to compare the third value to.
>
>    This algorithm is fundamentally flawed.
>
>
>
> You are correct. Thanks for notifying the error(s).

May be it will work:


open FD, "< pixconfig.txt";
open FD1, "< ip.log";

@arr=<FD>;

while (<FD1>)
{
 foreach $var (@arr)
 {
   $var=~chomp($var);
   # print "Check" . $var . "<==>".  $_;
   if ( $_ =~ /.*$var.*/ )
   {
     print $_;
   }
 }
}
# END

when,

pixconfig.txt is containing only one word for pattern matching.



--
--
Mail: [EMAIL PROTECTED] | www: http://geocities.com/kmuthu_gct/

Reply via email to