this only lasts locally in this sub
# Creates a hash %t that has the same contents as %toys
my %t = %{$_[0]};
# Modifies %t (which is unrelated to %toys)
$t{'leggo'} = "yes";
[$_[0]{'leggo'} = "yes";] is darned ugly!
Since you're not changing the reference itself (only that to which it refers), you can copy the reference into a more suitably named variable.
my ($toys) = @_;
$toys->{'leggo'} = 1;
Note that 1 and 0 (or undef) are usually used for boolean. It's not that using "yes" is problematic, it's that "no" isn't false. Formatting outputs (e.g. converting to "yes" and "no") should be done on output.
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.