gjb is absolutely right, but let's go a little bit deeper.

undef == undef, I don't know whether you feel bothered by this fact of Perl.

  1. From a pure "correctness" point of view, I actually feel bothered. There is something in your left hand, and you don't know what it is. There is also something in your right hand, again you don't know what it is. Can you say that you have the same things in both of your hands? You cannot.
  2. Try these two pieces of code:
    if ($a == $b) { print "equals\n"; }
    if ($a eq $b) { print "equals\n"; }
    Both pieces of code print out "equals", but at the same time, both complains that $a and $b are uninitialized. So we DOES observed some inconsistency.

When you use this undef value in a number context, perl evaulates undef to 0, and in a string context, evaluates undef to "" (empty string).

When you say undef == undef, both undef's are 0's, so 0 == 0. When you say undef eq undef, both undef's are "", so "" eq "".

In reply to Re: cgi problem by pg
in thread cgi problem by atnonis

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.