Friends,

I am having trouble dealing with 0 in certain cases. Here are a few snippts and what bugs me about them.
... my $MISC_FILE_DIR = shift || die usage(); my $req = shift || die usage(); my $inqfile = shift || die usage(); my $sent = shift || die usage(); my $status = shift || die "please specify status\n" . usa +ge(); ...
Zero is a valid value for status but how do I keep it from be treated like undef? Here's what happens when I use zero on the command-line.
bash-2.03$ insertIntoLN.pl misc 135 doesnt_matter 20031208120000 0 please specify status usage: ./insertIntoLN.pl <miscdir> <req> <inqfile> <sent> <status>
Also when I pull data out of the database zero seem to be treated as undef. Example)
... while( my @row = $sth->fetchrow_array ) { print join( '|', map ( $_ || 'NULL', @row )) ."\n"; } ...
Output I get is ...
137|src/20031208153031.txt|20031210093234|NULL|NULL 138|src/20031208153031.txt|20031210093509|NULL|NULL
... I was expecting the last column to be 0. What am I not getting here?
Thanks

Plankton: 1% Evil, 99% Hot Gas.

In reply to zero vs undef by Plankton

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.