Just use a hash is my routine advice - both for clarity and performance. See also Perl Best Practices (Chapter 6) (O'Reilly) (or Perl Best Practices (squirrel pdf)):
If performance is critical, you could always benchmark different approaches - see Fastest way to lookup a point in a set for a simple example of this.
Oh, and don't use Switch! :)
In reply to Re: Hash versus chain of elsifs
by eyepopslikeamosquito
in thread Hash versus chain of elsifs
by mldvx4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |