Turns out we're both wrong.

On the first technical note, I'm not wrong because all I did was to quote perlfunc. :-)

Empty lists are interpreted as undef in scalar context.

On the second technical note, there's no such thing as empty lists in scalar context, as far as I know. Your examples only show that eval returns the empty list in list context.

eval returns an empty list.

In list context it returns an empty list. In scalar context it returns undef. It doesn't return an empty list that evaluates to undef, because if it's in scalar context there can't be any list.

IMHO, if context isn't specified in the documentation, all contexts are implied. So either perlfunc needs to be fixed to say that it returns undef in scalar context and the empty list in list context, or eval need to return undef in list context too.

lodin


In reply to Re^6: Blessing interior hashes by lodin
in thread Blessing interior hashes by throop

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.