Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: recursive reference delete subroutine

by Zed_Lopez (Chaplain)
on Dec 16, 2004 at 05:30 UTC ( [id://415288]=note: print w/replies, xml ) Need Help??


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' );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://415288]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found