in reply to Re: Re: Re: Returning multiple values from a function
in thread Returning multiple values from a function
my $type; %results = findResults(\$type);
$type is then modified inside findResults() but only the hash is passed back to the caller. So the value of $type is changed but never passed back,so as to avoid slurpage
You can return only a scalar or a list from a function. To get a hash return, you either have to flatten it into a list (and reconstruct it at the other side) or return a reference to the hash
I haven't found this to be so, unless perl is taking care of the reconstruction for me. I returned a hash like so return %results; and the calling hash was populated correctly. I was able to do a foreach over each of the keys i had set. Perl is taking care of the reconstruction correct?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Returning multiple values from a function
by castaway (Parson) on Sep 04, 2003 at 07:35 UTC |