Plankton has asked for the wisdom of the Perl Monks concerning the following question:
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.... 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(); ...
Also when I pull data out of the database zero seem to be treated as undef. Example)bash-2.03$ insertIntoLN.pl misc 135 doesnt_matter 20031208120000 0 please specify status usage: ./insertIntoLN.pl <miscdir> <req> <inqfile> <sent> <status>
Output I get is ...... while( my @row = $sth->fetchrow_array ) { print join( '|', map ( $_ || 'NULL', @row )) ."\n"; } ...
... I was expecting the last column to be 0. What am I not getting here?137|src/20031208153031.txt|20031210093234|NULL|NULL 138|src/20031208153031.txt|20031210093509|NULL|NULL
| Plankton: 1% Evil, 99% Hot Gas. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: zero vs undef
by Abigail-II (Bishop) on Dec 09, 2003 at 17:09 UTC | |
by dragonchild (Archbishop) on Dec 09, 2003 at 21:12 UTC | |
by Abigail-II (Bishop) on Dec 09, 2003 at 21:46 UTC | |
|
Re: zero vs undef
by Aristotle (Chancellor) on Dec 09, 2003 at 17:14 UTC | |
|
Re: zero vs undef
by duff (Parson) on Dec 09, 2003 at 17:10 UTC | |
|
Re: zero vs undef
by Roy Johnson (Monsignor) on Dec 09, 2003 at 17:16 UTC |