in reply to order of evaluation of operands
Yes, Perl will call a() before it calls b(). That's why you can safely say: ($a,$b) = (shift, shift) to get the first two values from @_, IN THE RIGHT ORDER. (But you'd use splice(), really.)jeffp@friday [10:44am] parsers #264> perl -MO=Terse sub a { print 1 } sub b { print 2 } $c = a() + b(); - syntax OK LISTOP (0x13b940) pp_leave OP (0x130ef8) pp_enter COP (0x13b970) pp_nextstate BINOP (0x142ce0) pp_sassign BINOP (0x142d00) pp_add [3] UNOP (0x142c20) pp_entersub [1] UNOP (0x13b9d0) pp_null [141] OP (0x130f58) pp_pushmark UNOP (0x142c40) pp_null [17] GVOP (0x142c60) pp_gv GV (0x12dbac) *a UNOP (0x142d20) pp_entersub [2] UNOP (0x13ba90) pp_null [141] OP (0x130f70) pp_pushmark UNOP (0x142d40) pp_null [17] GVOP (0x142d60) pp_gv GV (0x14bbc4) *b UNOP (0x12ea00) pp_null [15] GVOP (0xbed00) pp_gvsv GV (0xc6304) *c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: order of evaluation of operands
by jlistf (Monk) on Jul 21, 2000 at 21:00 UTC | |
by japhy (Canon) on Jul 21, 2000 at 21:57 UTC |