in reply to Too much SQL not enough perl

why don't you simpy create your "in" subroutine?
sub in { my($inQuestion)= shift; foreach (@_) { return 1 if $_ eq $inQuestion; } return false; }
Okay... It looks somewhat different, but it's shorter
in($question, "a", "b", "c");

OTOH: If it's really a fixed set of allowed values, I'd go for a regex or hash (depending on the nature of the problem) too.

  1. if it's just the question, whether or not it's in a set of values, I'd take the regex approach like
    if ($day =~ /^(?:Mo|Tu|We|Th|Fr|Sa|Su)$/) ...
  2. if the options are also used to switch, what's done later, I'd prefer the hash way:
    if (defined $mnth= $monthNum{$month}) ...

$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print

Replies are listed 'Best First'.
Re^2: Too much SQL not enough perl
by nothingmuch (Priest) on Oct 10, 2005 at 08:12 UTC
    You can try to be really sick and create an in method using autobox.

    -nuffin
    zz zZ Z Z #!perl