\$inner is a reference to the scalar
$inner. It allows programmers to change the content of the variable
$inner without explicitly mentioning it by name in the source. You can just as well use a different variable and it'll work the same.
For example:
$apples = 10;
$pears = 6;
take_one(\$apples); # take one apple
take_one(\$pears); # take one pear
print "I've still got $apples apples and $pears pears.\n";
sub take_one {
my $ref = shift; # a reference
$$ref-- # access the value of the referenced scalar
}
This prints:
I've still got 9 apples and 5 pears.
For more info, check out perlreftut and perlref.
It's easy for a programmer to detect if a value is a reference: just use ref: it'll return an empty string for a normal string, and "SCALAR" for a reference to a scalar.
It's a convention among module authors to use a reference to a scalar if you want to actually use the string value as data, instead of as a file name from which you'll read the contents; for example in the various HTML parsing modules.
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.