Problems? Is your data what you think it is? | |
PerlMonks |
Re: The @_ array and the lexical variablesby choroba (Cardinal) |
on Apr 16, 2018 at 10:40 UTC ( [id://1212980]=note: print w/replies, xml ) | Need Help?? |
Elements of @_ are aliases to the arguments, i.e. when you change $_[0] directly, you change the original argument, which in this case happens to be $num, respectively %hash. See perlsub: The array @_ is a local array, but its elements are aliases for the actual scalar parameters. In particular, if an element $_[0] is updated, the corresponding argument is updated (or an error occurs if it is not updatable).
In Section
Seekers of Perl Wisdom
|
|