Hmm. I don't recall ever making the statement that your code was dangerous. You misunderstood "above". Your "real problems" listing is simply programming design which, as I said before, should be taken care of before actually programming. Therefore, when one does get to a line with a return, one is not worrying about "real problems" but whether or not such and such an optimization will prove effective.

Whoa there! Did I just read that a reference may be slower in the long run than copying hordes o' data? Perhaps on the order of ten elements this may be true (while this does not hold for C for obvious reasons) but for the example that we are supposed to be discussing, this will not be case (potentially large hashes). That's enough to warrant concern. You should also be careful with wantarray. A newbie may have problems with this since it the long run, it IS better to reference returns. If you don't, you are automatically guaranteed two copies of the same hash until the garbage collector finds the original- an obvious waste of resources. Imagine a poor PC user with already wasted resources dealing with bloated CGIs. That doesn't make anyone happy, especially since Windows doesn't return memory blocks to the OS (surprise! surprise! some OSs DO!) While agree that the return in your case is valid (since it needs to create the new memory and it doesn't matter where its malloc()'ed but this is still a very limited case. Perhaps we need to bring in Bob Barker with his Benchmark Showdown!:-)

AgentM Systems or Nasca Enterprises is not responsible for the comments made by AgentM- anywhere.

In reply to RE: RE (tilly) 4: Load Balancing fun.. by AgentM
in thread Load Balancing fun.. by reyjrar

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.