in reply to Short or Long Hand

Not so useful for a short list like this with only two elements, but

if(not @{[grep {$day == $_} (0,6)]}) { # foo }
Not much of a gain here, but imagine if the list were 20-30 elements.

Ron Steinke
<rsteinke@w-link.net>

Replies are listed 'Best First'.
•Re^2: Short or Long Hand
by merlyn (Sage) on Aug 12, 2004 at 16:04 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.
Re^2: Short or Long Hand
by Scarborough (Hermit) on Aug 12, 2004 at 15:26 UTC
    I like that one, I have a use for that when I'm working out my month end dates which in my case are not always the last day of the month.
    Thanks
      If you are doing much date manipulation at all, you should strongly consider using one of the fine modules available: DateTime, Date::Calc, Date::Manip, etc. There isn't much learning curve; most have FAQs with cut-and-paste recipes for common tasks.