in reply to Stumped when passing barewords
Although I'm not positive on that explanation, I believe it's something along those lines.sub sub2(*); sub sub1(*) { print "args(1): @_\n"; sub2(@_); } sub sub2(*) { print "args(2): @_\n"; } sub sub3(*) { print "args(3): @_\n"; sub2(@_); } sub1 Bareword; sub3 Bareword; __output__ args(1): Bareword args(2): 1 args(3): Bareword args(2): 1
Update: indeed, if we change the prototype between the compilation of the subs we see the output changes to the expected behaviour of the above explanation e.g
sub sub2(*); sub sub1(*) { print "args(1): @_\n"; sub2(@_); } sub sub2 { print "args(2): @_\n"; } sub sub3(*) { print "args(3): @_\n"; sub2(@_); } sub1 Bareword; sub3 Bareword; __output__ args(1): Bareword args(2): 1 args(3): Bareword args(2): Bareword
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Stumped when passing barewords
by Fletch (Bishop) on Apr 22, 2004 at 13:23 UTC | |
by crenz (Priest) on Apr 22, 2004 at 13:27 UTC | |
by Fletch (Bishop) on Apr 22, 2004 at 13:30 UTC | |
by crenz (Priest) on Apr 22, 2004 at 13:35 UTC | |
by Fletch (Bishop) on Apr 22, 2004 at 13:45 UTC |