in reply to Pass array, then clear
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Pass array, then clear
by Anonymous Monk on Jan 15, 2018 at 22:09 UTC | |
by AnomalousMonk (Archbishop) on Jan 15, 2018 at 23:34 UTC | |
by huck (Prior) on Jan 15, 2018 at 22:22 UTC |