A further look with B::Concise show that subsequent, simple assignments to $x also worked. It appears that because my $x is equivalent to my $x = undef, perl didn't bother actually writing the = undef part to the variable already guaranteed to be undef anyway. So its an optimization.

I'd like to note that no one should ever actually attempt to overload undef in anything outside obfuscations. Since undef is a process wide global in way that even normal globals aren't global, you're propogating this new, defined value to every other module that's being used in your code. Now everything that used to return undefined to indicate failure will automatically signal success on failure, anyone using undef() as a parameter to select() for a sleep() will find themselves testing actual file handles. This is a seriously bad design decision that will warp the hell out of any process that uses it. Its cute for trying things like this out but no one should ever, ever, ever actually do this.


In reply to Re^6: The Null Mull (or, when OO needs more O) by diotalevi
in thread The Null Mull (or, when OO needs more O) by brian_d_foy

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.