in reply to Re: Re: Nested foreach
in thread Nested foreach

You should change
$ignore =~ s/\b$ignore\b//;
to
$line =~ s/\b$ignore\b//g;

Replies are listed 'Best First'.
Re: Re: Re: Re: Nested foreach
by esoteric neonate (Novice) on Apr 25, 2003 at 18:16 UTC
    foreach my $line (@words) { $line =~ tr/A-Z/a-z/; foreach my $ignore (@ignore) { $line =~ s/\b$ignore\b//g; } }
    doesn't change the outcome of the program either :( No words are ignored but you were right, I need the //g :)
      Oh, I didn't notice that at the top, you need to change
      my @ignore = qq(a and the this i me us our ok abc);
      to
      my @ignore = qw(a and the this i me us our ok abc);
      I.e. change qq to qw.
        Thanks so much!! After looking at that I slapped myself in the forhead for making a mistake like that, I think this was my major problem all along (oh, I feel stupid). I was wondering why qq() didn't show up as an error but it turns out that's a real command too, go figure :)

        Thanks for your help Thelonius and every other monk who hasn't slapped themselves into the next cyberworld from my mistakes.