in reply to matching an array

So you have:
  1. an array with your form values (@params)
  2. and a file to select lines from, depending on the values?
don't you?

If this is it, your approach is not so much wrong. You should consider swapping the loops. You won't need any indexing then.

BTW: Is this homework?

Replies are listed 'Best First'.
Re: Re: matching an array
by Anonymous2003 (Initiate) on Aug 08, 2003 at 12:21 UTC
    o you mean swapping the "foreach" loop and the "while" one? like this?
    open (FILE1, "<tabtext.txt"); open (FILE2, ">ludo.txt"); while(<FILE1>){ foreach my $paramKey (@params){ if (/$paramKey/){ print FILE2; } } } close(FILE1); close(FILE2);
    and it's not an homework!! LOL