Paul Lalli wrote:
On Aug 9, 10:07 am, [EMAIL PROTECTED] (Oryann9) wrote:

Paul, what college?

Rensselaer Polytechnic Institute, Troy, NY

http://www.cs.rpi.edu/~lallip/perl/spring07

On that page at the Sunday, March 25, 2007 entry:

if (! $value) { ... } # $value is either 0, '', '0', or undef
if ($value == 0) { ... } # $value is either 0, '', '0', or undef - but will 
issue a warning for '', '0', or undef
if (!defined($value)) { ... } # $value is undef

0 and '0' are numerically equivalent so only '' and undef would issue a warning.

$ perl -le'
use warnings;
use strict;
my $c = 1;
for my $x ( 0, q[], q[0], undef ) {
    print $c++, ": $x" if $x == 0;
    }
'
1: 0
Argument "" isn't numeric in numeric eq (==) at -e line 6.
2:
3: 0
Use of uninitialized value in numeric eq (==) at -e line 6.
Use of uninitialized value in concatenation (.) or string at -e line 6.
4:




John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to