Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Illogical logic statement

by GrandFather (Saint)
on Dec 02, 2012 at 21:16 UTC ( [id://1006757]=note: print w/replies, xml ) Need Help??


in reply to Illogical logic statement

When I execute:

#!/usr/bin/perl use strict; use warnings; my $str = 'false'; if ($str == 'true') { print "$str=true\n"; } else { print "$str=false\n"; }

I get:

Argument "true" isn't numeric in numeric eq (==) at noname.pl line 7. false=true Argument "false" isn't numeric in numeric eq (==) at noname.pl line 7.

which is a pretty good heads up! Always use strictures (use strict; use warnings; - see The strictures, according to Seuss).

True laziness is hard work

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-25 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found