http://www.perlmonks.org?node_id=101743


in reply to IF NOT! IF NOT!

using perl regular expressions, try:
foreach my $word (@words) { print "$word\n" if ($word =~ /home/); }


--twerq

Replies are listed 'Best First'.
Re: Re: font color="#ff0000"IF NOT! IF NOT!/font
by myocom (Deacon) on Aug 02, 2001 at 22:51 UTC

    ...except that you got the logic backwards.

    I need an if statement to say something like "if grep can't find 'home' in a word, print the word."
    foreach (@words) { print "$_\n" unless /home/; }