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

Re: perlbool.pod rev.1

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
June 30, 2003 03:16
Subject:
Re: perlbool.pod rev.1
Message ID:
20030630121002.520cf12d.rgarcia@hexaflux.com
Autrijus Tang wrote:
> On Mon, Jun 30, 2003 at 05:42:44PM +0900, Dan Kogai wrote:
> > Like references already knows C<undef()> is always false so no
> 
> This should read:
> 
>     Like references, perl already knows...
> 
> > When you need a function that needs to return 0 in numerical value but
> > evaluates to true, use "0 but true" as the return value.
> 
> Oh my god.  Didn't realize there is a special-case right there 
> in numeric.c.

Not mentioning several builtins that may return "0 but true"
(see pp_sys.c). We're entering the dark realms of high dwimmery.

> Another way to do it is "0E0", and you may wish to add it as an
> alternative for mathematically-minded people.

Several modules use this. Net::POP3, for example, comes to mind.

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