On Jan 27, 2004, at 3:26 AM, Jan Eden wrote: [..]
I have a subroutine which fills into several hashes and arrays (%author_indexlines, %poem_lines, @alphabet_index etc). How can I return those variables and pass them to another subroutine? This does not work, of course
[..]

perldoc -q "How can I pass/return a {Function, FileHandle, Array,"

remember that your core signature is

my @return_list = function(@arglist);

so the only way that you can return more than one
array or hash will be by passing their refs

        my ($auther, $poem, $index) = function(@arglist);
        ....

        sub function {
                ....
                (\%author_indexlines, \%poem_lines, [EMAIL PROTECTED], $etc)
        }

then you re-ref them as

        while( my ($k,$v) = each %$author )
        {
                ....
        }

ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to