Perl: the Markov chain saw PerlMonks

### Comment on

 Need Help??
Sorry, that was a last minute change. In order to simplify the code for inclusion here, I left out a trivial optimization where I convert HASH to an integer:
```
use constant Array  => 1;
use constant Hash   => Array << 1;
our %_typemap=(ARRAY=>Array, HASH=>Hash);

sub _Var (\$\$\$;\$) {                          # Wrkhorse code for manu
+fctrd Vars
my (\$__, \$p, \$vn, \$wa)=@\$_;
\$_=\$__;                                   # must not trash '\$_'
my \$v   = \$p->{\$vn};                      # value
my \$rfv = ref \$v;                         # type(ref) of var
my \$rfvi  = \$_typemap{\$rfv} || 0;
if (\$wa && \$wa eq '&#945;') { \$wa=undef, \$addrof=1 }
if (@_ && !\$addrof)  {                    # arg for "setter"
\$arg = shift;
my \$refarg = ref \$arg;                  # ref of the arg
unless ( defined(\$p->{\$vn}) && defined \$arg ){  # unless both de
+fined
\$p->{\$vn} = \$arg;
} elsif (\$rfvi == Array) {              ## if type(var)==ARRAY,
+1 param
if (\$refarg ne "ARRAY" ||  (@\$arg || @\$v)) {
push @{\$p->{\$vn}}, \$_[0];           ## convert to "push"
}
} elsif (\$rfvi == Hash) {
I tried to cut down the amount of code included by cutting out the integer thing...sorry. I didn't want to get dinged for not trying to cut things down...

In reply to Re^6: How to return values from a hash? by perl-diddler
in thread How to return values from a hash? by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• 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.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, 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?

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-05-28 06:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
World peace can best be achieved by:

Results (199 votes). Check out past polls.

Notices?