Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Illogical logic statement

by roboticus (Chancellor)
on Dec 01, 2012 at 02:37 UTC ( #1006558=note: print w/ replies, xml ) Need Help??

in reply to Illogical logic statement


Nearly all values are true. False is reserved for a select few values like 0, '0' and ''.

Roboticus@Roboticus-PC ~ $ perl 0 is false 0 is false foo is true bar is true fkento is true true is true false is true yes is true no is true is false Roboticus@Roboticus-PC ~ $ cat #!/usr/bin/perl use strict; use warnings; for my $t (0, qw(0 foo bar fkento true false yes no), '') { print "$t is ", ($t ? 'true' : 'false'), "\n"; }

Remember--text strings are just strings, even if they say "false" or "true". You should read the perldata (third paragraph after 'scalar' heading) for the basics.


When your only tool is a hammer, all problems look like your thumb.

Comment on Re: Illogical logic statement
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2015-11-29 01:37 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls