in reply to Hash versus chain of elsifs
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! :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash versus chain of elsifs
by mldvx4 (Hermit) on Nov 22, 2021 at 11:37 UTC | |
by eyepopslikeamosquito (Archbishop) on Nov 22, 2021 at 12:03 UTC | |
by mldvx4 (Hermit) on Nov 22, 2021 at 13:43 UTC |