develooper Front page | perl.perl5.porters | Postings from July 2003

Re: perlbool.pod rev.2

Thread Previous | Thread Next
From:
Abigail
Date:
July 10, 2003 05:43
Subject:
Re: perlbool.pod rev.2
Message ID:
20030710124233.GC24003@abigail.nl
On Mon, Jun 30, 2003 at 08:34:45PM +0900, Dan Kogai wrote:
> Autrijus and Rafael,
> 
> Here it is, the 2nd rev.
> 
> "0 but Dan the Perl5 Porter"
> 
> =head1 NAME
> 
> perlbool - semantics of boolean operations and conversions in Perl
> 
> =head1 SYNOPSIS
> 
>   $f = "0";          # false by definition
>   $f = "";           # false by definition
>   $f = 0;            # false by definition
>   $f = 0.00;         # false because 0.00 == 0.
>   $t =  \$a;         # always true
>   $f = undef         # always false

I always thought that was by definition also. 

> 
> =head2 undef
> 
> C<undef()> is always false because it would evaluate to C<""> in
> string context and C<0> in numerical context.

Well, if either of string conversion or numeric conversion takes place,
only one of C<0> and C<"0"> needs to be "false by definition".


Abigail

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About