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

Re: Re: Our, use vars, and magic, oh my!

by Hofmator (Curate)
on Aug 23, 2001 at 19:47 UTC ( [id://107375]=note: print w/replies, xml ) Need Help??


in reply to Re: Our, use vars, and magic, oh my!
in thread Our, use vars, and magic, oh my!

our variables can be seen in subroutines and my variables declared at the top of your script cannot be seen inside your subroutines.
This is only true if you put your subroutines above the top of the script, i.e. above the my declarations.

Some code - where $var can be accessed in the subroutine:

use strict; my $var = 4; sub foo { $var = 'bar'; } foo; print $var;

-- Hofmator

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-25 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found