Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
as a newbie in Perl I use snippets of the others' code and try to understand them.
Now I have a piece of code which works but I do not understand why.
I pass arguments to a subroutine as follows (I need a populated hash in the subroutine):
Then I take the parameter in the subroutine:
Thank you!
as a newbie in Perl I use snippets of the others' code and try to understand them.
Now I have a piece of code which works but I do not understand why.
I pass arguments to a subroutine as follows (I need a populated hash in the subroutine):
sub marine($string, \%hash)
Then I take the parameter in the subroutine:
The line that I do not understand is my(%hash) = %{(shift)};. Why there are parenthesis there? Could you please explain this?sub marine { my $line = shift; my(%hash) = %{(shift)}; ... }
Thank you!
Back to
Seekers of Perl Wisdom