Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: font color="#ff0000"IF NOT! IF NOT!/font

by twerq (Deacon)
on Aug 02, 2001 at 22:48 UTC ( [id://101743]=note: print w/replies, xml ) Need Help??

in reply to IF NOT! IF NOT!

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


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/; }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://101743]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-06-17 17:58 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.