[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SLUG] Perl Q



an option could be to split it up....

my(@nospam.A) = readData('a');
my(@nospam.B) = readData('b');

sub readData
{
if ($_ eq 'a') { return @nospam.A;};
if ($_ eq 'b') { return @nospam.B;};
};

i think $_ might be @nospam._ 
but you get the point

Dean

Michael Lake wrote:
> 
> Hi,
> 
> Simple Q,
> 
> My perl script has a function and I want to return two
> arrays from the function. I found that I can't just assign
> the return values like this;
> 
> (@nospam.A, @nospam.B) = readData();
> 
> sub readData
> {
>         # get data and create @nospam.A and @nospam.B
>         return (@nospam.A, @nospam.B);
> }
> 
> My perl book doesn't cover returning more than one array. Do
> I use references? I don't want to put A and B into a single
> array and return that then later have to separate out A and
> B.
> 
> The perl script runs on my Linux box here via apache and is
> part of the new computer based chemistry experiment for this
> semester coming up.
> 
> Mike
> --
> --------------------------------------------------------------------
> Michael Lake
> University of Technology, Sydney
> Email: mailto:Mike.Lake@nospam.uts.edu.au Ph: 02 9514 1724 Fx: 02
> 9514 1628
> URL: http://www.science.uts.edu.au/~michael-lake/
> Linux enthusiast, active caver and interested in anything
> technical.
> --------------------------------------------------------------------
> 
> --
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://slug.org.au/lists/listinfo/slug


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug