LPM: passing array refs

Matt Cashner sungo at brocksplace.com
Fri Jan 21 23:58:18 CST 2000


On Fri, 21 Jan 2000, Rich Bowen wrote:

> The problem, of course, is that if you have a prototype of @$, how would
> perl know when the array was to stop and the scalar to start? So you end
> up with all your arguments in the array, and nothing in the scalary.
> Worse yet, imagine @$@, and try to figure out what goes in the scalar if
> I pass (1,2,3,4,5,6,7).

the way i'm reading Programming Perl (which might be wrong :) is that the
prototype @$ actually expects an array ref as the first argument. so if
you prototype sub foo (@$) { BLOCK } you invoke it by foo(\@array,$var); 
and sub foo (\@$) { BLOCK } would be invoked by foo(@array,$var); with the
magical transformation of @array to a ref. now, if i can get that to
actually work is another thing :)

---------------------
Matt Cashner
 sungo at earthling.net
---------------------

"If we dont take care of the customer, maybe they'll stop bugging us."




More information about the Lexington-pm mailing list