There's more than one way to do things | |
PerlMonks |
Re: Pass array, then clearby pwagyi (Monk) |
on Jan 16, 2018 at 02:13 UTC ( [id://1207330]=note: print w/replies, xml ) | Need Help?? |
If you have knowledge with pointer (C/C++) it is pretty much the same in Perl.
$ref is a pointer(reference) variable, it stores only address(so as to speak). So when $ref is assigned to point to another object, subroutine caller does not see the change. On the other hand, if you assign what $ref points to (deference), the change is reflected in caller.
In Section
Seekers of Perl Wisdom
|
|