If you add print "@_\n"; between sub zivad { and my $animal = shift;, perl will tell you exactly what is in @_. In this case you'd see mago (which comes from print zivad('mago');).
%list can be accessed anywhere after my in the snippet you posted, and that's just what your subroutine is doing.
This is what happens step-by-step
In reply to Re: how do subroutines work
by FunkyMonk
in thread how do subroutines work
by baxy77bax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |