in reply to Re: Memory Use and/or efficiency passing scalars to subs
in thread Memory Use and/or efficiency passing scalars to subs
But the scalar refs point to the same memory address, which is natural for the main program and the direct sub, but completely unexpected (at least for me) for the indirect sub.sub direct(\$\$) { print $_[0] . " " . $_[1] . "\n"; } sub indirect($$) { my ($one, $two) = \(@_); print $one . " " . $two . "\n"; } my ($first, $second) = qw(Hi there); print \$first . " " . \$second . "\n"; direct $first, $second; indirect $first, $second; __END__ SCALAR(0x1823c78) SCALAR(0x224f88) SCALAR(0x1823c78) SCALAR(0x224f88) SCALAR(0x1823c78) SCALAR(0x224f88)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Memory Use and/or efficiency passing scalars to subs
by Limbic~Region (Chancellor) on Aug 30, 2003 at 15:38 UTC | |
by knexus (Hermit) on Aug 30, 2003 at 17:21 UTC | |
by Limbic~Region (Chancellor) on Aug 30, 2003 at 17:34 UTC |