Inside clear_it $data is a local variable that you assign a reference to from the parm stack. the uncommented version then assigns a reference to a empty hash to that local variable. As the subroutine exits the internal $data variable containing the reference is destroyed.
The commented version uses the reference contained in $data as an address to an array and assigns the empty array to that reference
In reply to Re: Pass array, then clear
by huck
in thread Pass array, then clear
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |