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