Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Baby Steps

by davorg (Chancellor)
on Jun 22, 2000 at 20:04 UTC ( [id://19500]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Baby Steps "if" behavior?

Perl values can be defined or undefined and true or false (all undefined values are also false). Elements in a hash can, in addition, exist or not. The following code might go some way to explaining the differences:

#!/usr/bin/perl -w use strict; my %hash = (a => 1, b => 0, c => undef); foreach ('a' .. 'd') { print "\$hash{$_) : "; if (exists $hash{$_}) { if (defined $hash{$_}) { if ($hash{$_}) { print "exists, defined & true\n"; } else { print "exists, defined & false\n"; } } else { print "exists, undefined & false\n" } } else { print "non-existant, undefined & false\n"; } }

--
<http://www.dave.org.uk>

European Perl Conference - Sept 22/24 2000
<http://www.yapc.org/Europe/>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://19500]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.