http://qs1969.pair.com?node_id=415288


in reply to Re^2: recursive reference delete subroutine
in thread recursive reference delete subroutine

I was presuming the OP would replace the calls to deleteref with just the undef. You're right, of course, that making a copy of the reference in a subroutine and undeffing that is a no-op.

use Test::More tests => 2; sub deleteref { my $h = shift; undef $h; } my $c = {d => 3}; deleteref($c); is( keys %$c, 1, 'undef on copy of hashref in a subroutine should not clear it' ); undef $c; is( keys %$c, 0, 'undef on hash reference, not a copy of it in a subroutine, should + clear it' );