R
Ross Clement
Hi. Does anyone have any hints as to the best way to return multiple
arrays from a function? Normally, being a rather object oriented kinda
guy, I use objects for most data, making return from a function easy.
But, sometimes I just want to get the job done quickly, and prefer to
return arrays.
What I'm trying right now (i.e., I haven't fully tested this yet) is
the following:
# define the function as:
sub func
{
my %hash = ();
my @arr = ();
# etc etc etc
return (\%hash, \@arr );
}
# and then have the calling code is:
($myhash, $myarr) = &func();
Any hints for better ways to do this?
Cheers,
Ross-c
arrays from a function? Normally, being a rather object oriented kinda
guy, I use objects for most data, making return from a function easy.
But, sometimes I just want to get the job done quickly, and prefer to
return arrays.
What I'm trying right now (i.e., I haven't fully tested this yet) is
the following:
# define the function as:
sub func
{
my %hash = ();
my @arr = ();
# etc etc etc
return (\%hash, \@arr );
}
# and then have the calling code is:
($myhash, $myarr) = &func();
Any hints for better ways to do this?
Cheers,
Ross-c