On Mon, Mar 17, 2008 at 7:12 AM,  <[EMAIL PROTECTED]> wrote:
>  Are subs always return references or only for anonymous lists/hashes?

perldoc perlsub
"The Perl model for function call and return values is simple: all
functions are passed as parameters one single flat list of scalars,
and all functions likewise return to their caller one single flat list
of scalars. Any arrays or hashes in these call and return lists will
collapse, losing their identities--but you may always use
pass-by-reference instead to avoid this. Both call and return lists
may contain as many or as few scalar elements as you'd like. "

perldoc perlref
A reference to an anonymous hash can be created using curly brackets:

    $hashref = {
        'Adam'  => 'Eve',
        'Clyde' => 'Bonnie',
    };


So. Anonymous hashes create a reference. So its returning a ref. And
subs can't return hashes in any case. Just scalar lists.

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


Reply via email to