in reply to Re^6: Snarky comments on the ddj perl quiz
in thread Snarky comments on the ddj perl quiz

I admit to being a little puzzled by the "already" so long after the fact, but thought the link to the other thread was a good thing.

I could swear that I saw the other thread on Monday and later in the day this one appeared. Other than Seekers of Perl Wisdom I usually rely on just The Monastery Gates so a thread may be a few days old but will appear to be "new" to me if it was recently frontpaged. So it's either a question of when they were frontpaged or if I saw the other one while somehow missing this one. Sorry for any confusion!

Update: And sorry about sort of hijacking your thread.

  • Comment on (OT) Re^7: Snarky comments on the ddj perl quiz

Replies are listed 'Best First'.
Re^8: Snarky comments on the ddj perl quiz (hijack, pvnv memory)
by ysth (Canon) on Aug 30, 2007 at 22:27 UTC
    Our thread, for us to use and abuse as any of us see fit.

    Did you know that:

    $x = "1.1"; $y = 0+$x;
    leaves $x taking less memory than
    $x = 1.1; $y = "$x";
    ?
      LOL!! No I didn't and asking why is certainly worthier than some of those DDJ questions! Okay, so I'll bite -- why does it use less? I really do not know enough about perl to answer that one and my C is getting very rusty. Still, I doubt a three element char* uses more memory than a float so this sounds like a Perl-ism. Does perl end up storing a numerical and a string version in the second example while just converting from a string to a numeric in the first example? Or put differently, does the first example give perl a better hint? Is this part of the Perl spec or just a side effect of the perl implementation?
        Both store both the integer and character value. But one uses a 4-byte string buffer and one (for reasons unknown to me, but perhaps related to the longest conceivable stringification of a floating point number) uses a 36-byte string buffer.