good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Regarding speed: Is elsif or just if faster?by davidj (Priest) |
on Feb 25, 2007 at 01:04 UTC ( [id://601948]=note: print w/replies, xml ) | Need Help?? |
I had a situation once where I needed to switch on 14 or 15 possible variable values. It made more sense to me to to write a hash of function refs. I never benchmarked it for speed, but I sure found it much easier to maintain over the long term, especially as the requirements for each possible variable changed. Something like this:
davidj
In Section
Seekers of Perl Wisdom
|
|