If you want a concise definition, you should check out the manual pages. You can find them in the
Library, if you don't already have them.
That said, here is a brief in plain english.
my() creates a lexical variable that is local to the block it's in. If you declare my $foo;and call function my_function(), my_function() will not have access to $foo.
local() on the other hand, creates a variable that is local to the current block, and blocks it calls. so my_function() will be able to get at $foo, if you declare it local $foo;
There is more to it than this, but it's a start.
--4c6966653a205468652073656172636820666f
7220746861742070657266656374204765656b
20436869632c20746865206f6e652077697468
2074686520737061726b6c696e672065796573
2077686f20706c617973206973207261696e2e
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.