in reply to Nested foreach

You want to use a different loop variable in your inner-loop; and then bind the substitution to $line:
foreach my $line (@words) { $line =~ tr/A-Z/a-z/; foreach my $ignore (@ignore) { $line =~ s/\b$ignore\b//; } }
I've also added \b assertions around the word that you're ignoring, to prevent strange modifications in the middle of words. --Dave