Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

How scoping works in If statements?

by prasadbabu (Prior)
on May 30, 2008 at 06:23 UTC ( [id://689142]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        # the traditional way
        if ($zippy) {
    ...
        # the Perlish post-condition way
        print "Yow!" if $zippy;
    
  2. or download this
    my $x = 10;
    
    ...
    my $x = 5 if (1);
    
    print $x; #prints 5
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://689142]
Approved by Corion
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-29 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found