Given that undef is designed to do that job, I wonder why you would use anything else?
use Devel::Size qw[ total_size ];; @a = 1 .. 1e6;; print total_size( \@a );; 32000176 @a = ();; print total_size( \@a );; 8000176
@a = 1 .. 1e6;; print total_size( \@a );; 32000176 splice @a;; print total_size( \@a );; 8000176
@a = 1 .. 1e6;; print total_size( \@a );; 32000176 undef @a;; print total_size( \@a );; 176
All it retains the essential head structure.
In reply to Re: arrays : splice or undef ?
by BrowserUk
in thread arrays : splice or undef ?
by JockoHelios
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |