Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: The best "true zero" is...

by theorbtwo (Prior)
on Jun 09, 2005 at 10:41 UTC ( #465052=note: print w/ replies, xml ) Need Help??

in reply to The best "true zero" is...

A lot of people don't seem to understand the poll... or I'm not getting their jokes, which is also possible.

Anyway, there is sometimes a wish for something that is considered zero when used in numeric context, but true when used in boolean context, that is something that will make the following print "42\n":

#!/usr/bin/perl use warnings; use strict; my $x='<some choice on the poll>'; print $x+42, "\n" if ($x);

Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Comment on Re: The best "true zero" is...
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://465052]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-10-08 20:42 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (226 votes), past polls