Yeah, obviously the difference isn't huge by any measure. The return s perhaps offer that minimal speed gain by potentially decreasing the number of operations in the sorting sub.

Re: exists vs. defined. Clearly these test for different things (for onlookers, whether a key exists in a hash, and whether the value in the hash corresponding to the key has been defined), and there are obviously contexts in which it would be an error to confuse them. But if you keep a tight rein on your hash (as was done in the code above), there's no functional difference here : $last{"not other"} fed to either function is going to return a false value. I suppose that forcing you to keep a tight rein on your hash could be your worry, but if your code (not Fastolfe in particular, of course!) is creating hash keys that you're not aware of, you're probably in trouble anyway =)

Or am I missing something? (does, e.g. calling defined $hash{$key} create an entry for $key in $hash)?

Philosophy can be made out of anything. Or less -- Jerry A. Fodor


In reply to RE: RE: A discriminating sort (and some damned lies) by arturo
in thread A discriminating sort (and some damned lies) by arturo

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.