if (/^sub /) { return eval->( evalTree($intree->{left},$param), evalTree($intree->{right},$param) );
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).

This reminds me of a friend that made use of eval in a "unique" way, the first time I saw that time.

#!/usr/bin/perl # no -w # no strict eval { ... the rest of the program... }; die $@ if $@;
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.

These two examples prove a) TMTOWTDI principle, b) not all W's are equal.

Otherwise your tomatoes, rotten cabbage, and half eaten apples are appreciated
No, 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!


In reply to Re: optimization help by naikonta
in thread optimization help by GSF

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.