[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SLUG] Perl Q
Russell Davies wrote:
> ; 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);
> ; }
>
> Don't do that. In order to do what you want, you need to be using
> array references.
> return \(@nospam.a, @nospam.b);
Ah. I had tried return (\@nospam.A, \@nospam.B); but got references back
ie
ARRAY(0x80d721c)1 ARRAY(0x80d7234)
> man perlref.
Great. I had tried perldoc -q ref and various incantations
but no use.
perlref refers me also to perlreftut for a tutorial and will
read up on this and get back.
Thanks
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