He assures me that this is a documented feature.
Indeed it is, right at the top of
perlref:
Note that taking a reference to an enumerated list is not the same as using square brackets--instead it's the same as creating a list of references!
@list = (\$a, \@b, \%c);
@list = \($a, @b, %c); # same thing!
As a special case, \(@foo) returns a list of references to the contents of @foo, not a reference to @foo itself. Likewise for %foo.
Update
I realized I didn't answer the question....
I think:
B::Deparse to the rescue: your code compiles to:
SWITCH: {
last SWITCH if $id == $CASH and $tcash += $amt;
last SWITCH if $id == $ACCOUNT and $taccount += $amt;
last SWITCH if $id == $CHECK and $tcheck += $amt;
last SWITCH if $id == $GIFT and $tgift += $amt;
last SWITCH if $id == $VOUCHER and $tvoucher += $amt;
last SWITCH if $id == $CC_MAN_AUTH and $tcc_man_auth += $amt;
$tcredit += $amt;
}
So you're continuing to the next case if $amt and the value being increased are both zero. Though that shouldn't cause any harm....
Update 2
Ack, I think I got it! Thanks Aristotle!
$amt can be negative. It can still bring one of the others to zero, then get decremented from the following branch.
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.