Jason, You state your question, and practically give the answer in the solution. :-)
You have a for loop inside a while loop. Both loops set $_. You state that you can not properly do your match within the for loop because you need the $_ value set by the while loop. Well ... why don't you just "save" the value of $_ set by while? See code below: "Jason Wozniak" <[EMAIL PROTECTED]> wrote in message ... <snip> > lies in the while loop of my search subroutine. If I use a for loop to > iterate over all the passwords for each line of the input file, $_ is > overwritten with a numeric value before the matching can take place, so > I can't match the line I'm reading in from the file. If I get rid of > the for loop and use a counter like $count to iterate through my array, <snip> > while (<FILE>) { while ( defined(my $line=<FILE>) ) { > for (0..$#passwords) { > if (/$passwords[$_]/) { if ($line =~ /$passwords[$_]/) { > print "Match found!\n"; > print TMPFILE $file > or die "Could not write to file: $!\n"; > } > } > } > } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>