Hmm. Ok, well this brings up another question. I guess I kind of assumed that "our" variables were just another way of declaring variables that could be used throughout the main program. Now that I think of it, I guess that makes no sense. Which, er might mean I'm using that incorrectly. If you declare a "local" variable with "my" in the main scope, you can still access it in all of the subroutines in the program. So, how is using "our" different than that? Is that similar to declaring something "public" in an object in java? i.e. if I were creating an object everyone could access (change?) an "our" declared variable, while a "my" declared variable ... not accessible? Or not changeable?
Update: ok, little trip to our has revealed that I appear to have been completely wrong, except for the parts I was right about. Something which I'm still not clear about though is the accessibility of "our" vs. "my" declared variables. If one can "access" them does that imply the ability to change them? I'm thinking about this as an "our" variable being able to be accessed by something outside the main scope... is it just visible, or is it mutable? (are "my" declared variables visible outside of the scope they are called in? I'm assuming definitely not mutable).
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|