in reply to Too much SQL not enough perl
Okay... It looks somewhat different, but it's shortersub in { my($inQuestion)= shift; foreach (@_) { return 1 if $_ eq $inQuestion; } return false; }
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.
if ($day =~ /^(?:Mo|Tu|We|Th|Fr|Sa|Su)$/) ...
if (defined $mnth= $monthNum{$month}) ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Too much SQL not enough perl
by nothingmuch (Priest) on Oct 10, 2005 at 08:12 UTC |