For the low down on Perl references see perlref. You will probably find that perlsub helps too.
The important bits are:
The Perl model for function call and return values is simple: all functions are passed as parameters one single flat list of scalars
and:
Any arrays or hashes in these call and return lists will collapse, losing their identities
in:
my (...) = @_;
the () provides a list context for the assignment so the elements in @_ are assigned in turn to the variables in (...). In the sample code there happens to be only one element in the list and we could instead have used one of:
my $hash = $_[0]; my $hash = shift;
instead. If you omit the (), then the assignment sees a scalar and assigns the number of elements in @_ to $hash rather than the contents of the first element.
In reply to Re^3: Trouble passing hash into function
by GrandFather
in thread Trouble passing hash into function
by dbonneville
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |