Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by theorbtwo (Prior)
on Jun 09, 2005 at 10:41 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-19 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found