in reply to Remove multiple lines of text
You're overwriting $TheLine with the default variable, "it" ($_) outside your loop and then creating another $TheLine that is out of scope (within the loop).$TheLine = $_; while (my $TheLine = <INPUT>) { # ....etc. }
Here's one way of doing what I think you want. It's probably not the most advanced way, but I hope it makes sense and helps in your understanding of what's gone wrong.
@lines = <INPUT>; for (@lines) { if (/<RD>[^\n]*Status Compendium<<.JL>/i ) { # notice that $_ is assumed here foreach my $word (@WordList) { print OUTPUT if($_ ne $word) # here we need $_ for camparison (?) } } }
|
|---|