Perl has two different kinds of variables, private variables declared with
my and package variables (usually) declared with
our
- a lexical scope in Perl is anything from declaration till end of enclosing { block }
- the biggest possible lexical scope outside a block is the file, aka file-scope
- lexical ( i.e. "as you read" the static code ) is opposed to "dynamic" (i.e. run-time effects)
- main:: and other package s are namespaces not scopes, think of them as hashes of variables and functions
- my variables do not belong to namespaces, our vars do
- global means accessible everywhere, all namespaces including vars and subs are global as long as you use the *fully::qualified::name
- special variables always belong to main::
for sources, e.g. "Scoping" see
Update
And an excellent overview can be found in
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.