Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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]
NodeReaper gets another author to use Module::Build

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2017-04-26 00:21 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (466 votes). Check out past polls.