in reply to Efficiency & Maintenance: if/elsif or Other Dispatch Method
And as is periodically mentioned, the conventional wisdom on using Switch in production is "you shouldn't" (straight from the horse's mouth, Categorized Damian Modules).
Update: And as for suggestions, since you've got a predicate rather than a simple key you could still use a dispatch table, it's just not as direct. I haven't looked at your sample data directly, but often you can find some mathematical function which converts a value to a "bin" number (as a really trivial example, something like int( $value / 10 ) to map a value 0..100 into bins 0..10). You then use that function as the key in your dispatch table instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Efficiency & Maintenance: if/elsif or Other Dispatch Method
by Limbic~Region (Chancellor) on Dec 01, 2006 at 19:19 UTC |