Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-16 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found