Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://465052]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2018-03-18 00:59 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (228 votes). Check out past polls.