in reply to Re: Re: font color="#ff0000"IF NOT! IF NOT!/font
in thread IF NOT! IF NOT!
As an aside, the construct ! grep EXPR, LIST is used in a boolean context. Either grep returns a list or it doesn't. ! evaluates in a boolean context. A list is TRUE and no list is FALSE.Not the best way to put it, IMHO ... to clarify: in scalar context grep returns the number of times it matched. So if it didn't match anything, it returns 0 which evaluates to false. Otherwise it returns a positive number which evaluates to true.
The boolean context is enforced by the if (and by the !), so that the grep in if (grep /blah/, @array)also evaluates in boolean context.
-- Hofmator
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re{4}: IF NOT! IF NOT!
by dragonchild (Archbishop) on Aug 03, 2001 at 17:17 UTC | |
by Hofmator (Curate) on Aug 03, 2001 at 17:43 UTC | |
by dragonchild (Archbishop) on Aug 03, 2001 at 17:54 UTC |