in reply to optimization help
This is tricky, but its trickiness doesn't help in any means. I needed to lookup perldoc -f eval again to make myself sure that eval is one of them that takes $_. I still wonder, though, experienced monk like samtregar got bitten too (sorry, Sam) :-) I still thank him for giving me a little hint (thank you, Sam).if (/^sub /) { return eval->( evalTree($intree->{left},$param), evalTree($intree->{right},$param) );
This reminds me of a friend that made use of eval in a "unique" way, the first time I saw that time.
There was nothing wrong with this program, syntatically, and it worked. I coudn't explain then, but I knew this was not right so I rejected his code and told him to code in the usual manner. Now I can say that unnecessary double evaluation is evil.#!/usr/bin/perl # no -w # no strict eval { ... the rest of the program... }; die $@ if $@;
These two examples prove a) TMTOWTDI principle, b) not all W's are equal.
Otherwise your tomatoes, rotten cabbage, and half eaten apples are appreciatedNo, I won't do that, especially when I know that this is not originally your own code. Even if it was, there was still no reason to do so. You asked in the proper manner. ikegami has said what was wrong and the correction as well.
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: optimization help
by chromatic (Archbishop) on Oct 16, 2007 at 05:43 UTC | |
by naikonta (Curate) on Oct 17, 2007 at 08:09 UTC |