Mmmm i think that there is an error in camel book third edition,I looked if someone noticed before me, but i didnt find anything ...
Likewise, you can pass a reference into a subroutine and use it withou
+t dereferencing:
%units = (miles => 6, stones => 11);
fillerup( \%units ); # Pass in a reference
print $units{quarts}; # Prints 4
sub fillerup {
local *hashsym = shift; # Assign \%units to the typeglob
$hashsym{quarts} = 4; # Affects %units; no dereferencing neede
+d!
}
These are tricky ways to pass around references cheaply when you don't
+ want to have to explicitly dereference them. Note that both techniqu
+es only work with package variables; they would not have worked had w
+e declared %units with my.
I have declare my %units and still working ....
Under use strict i have to declare our %hashsym, but still working again.
Im missing something or its an error?
$anarion=\$anarion;
s==q^QBY_^=,$_^=$[x7,print
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.