Problems? Is your data what you think it is? | |
PerlMonks |
Re^2: Increasing the efficiency of the codeby Limbic~Region (Chancellor) |
on Nov 29, 2006 at 13:14 UTC ( [id://586686]=note: print w/replies, xml ) | Need Help?? |
Fengor,
If you implemented a hash with the numerical operators as keys and the string operators as their corresponding values couldn't you rewrite the whole if elsif else etc construct as: You have a good idea and yes, it will lead to a performance increase. Unfortunately your implementation is less than desireable. Using a string eval can be very dangerous and should be avoided when better alternatives exist. In this case, a dispatch table is better suited. See my post below for an example. Cheers - L~R
In Section
Seekers of Perl Wisdom
|
|