I was pretty surprised by this, too. I have comments on your test, and then a theory. First the comments:
The values in @find are integers, but in the if_else comparison tree, you test for string equality.
Testing the hash for existance of a key first, seems wasteful. It might be faster if you did an eval and only acted on failure in that case. Of course, I haven't benched that, yet.
My theory: maybe, just maybe, perl does the thing C used to (and maybe still does) and and builds if-else chains into a hash table for evaluation. Dunno.
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||
Others about the Monastery:
(11)As of 2017-01-24 18:27 GMT