Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

•Re^2: Short or Long Hand

by merlyn (Sage)
on Aug 12, 2004 at 16:04 UTC ( [id://382327] : note . print w/replies, xml ) Need Help??


in reply to Re: Short or Long Hand
in thread Short or Long Hand

I think you're aiming for obfuscation there. The grep operator returns the number of matches in a scalar context, so you could have just said:
unless (grep $day == $_, 0, 6) { ... }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^3: Short or Long Hand
by roju (Friar) on Aug 19, 2004 at 16:36 UTC
    I like that. Although it's a good argument for something like an in operator. if ($day in (0,6)) is (to me) much cleaner in meaning, even if it's just syntactic sugar for the grep.