for clarification

> Interestingly, given the general discussion here, the FALSE value returned for a zero-length EXPR is 0, while the FALSE value returned for an undefined EXPR is undef.

Some operators in Perl return an internal magic boolean value, which is !!0 for FALSE and !!1 for TRUE.

length is not one of them, it returns values which are interpreted as FALSE or TRUE, returning undef for undef is very consistent in my eyes.

Though one probably could argue that warnings uninitialized should trow a warning here, I'm a bit confused in this matter.

I remember that tobyink started a discussion once that warnings uninitialized leads to inconsistent behaviour.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice


In reply to Re^3: methods for dealing with zero '0' as a string or char by LanX
in thread methods for dealing with zero '0' as a string or char by boleary

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.