Let's say I'm calling a function and passing some stuff:
some_function(@array, $var1, $var2);
In the function, I want to assign the array and variables to an array and variables local to the function. Something like this:
sub some_function { my (@local_array, $var1, $var2) = @_; ... }
However, this does not work in the way I expected. I think I have the syntax for passing an array wrong. Any suggestions?
In the interest of completeness, as everyone else is telling you how to handle array refs, I should probably point out that recent versions of Perl (5.6.1, perhaps 5.6.0?) allow you to prototype functions. So you could do
sub myfunction ([EMAIL PROTECTED]) { my ($array_ref, $var1, $var2) = @_; ...
At least, I think this is how it works. This way, although internally the function works with the array ref, you can still call it as:
myfunction @array, $v1, $v2;
There are a few caveats on this -- look up "prototypes" in the Camel book for more info...
HTH, Ricky
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs