undefing a hash

J

Jim

Hello,

when i undef a anonymous hash that contains other anonymous hashes and areas, e.g.

$hashref = { a => 'a', b => { c => 'c' } };
undef $hashref;

will the undef also undef all data structures inside the tree of data?

much thanks,
Jim
 
G

Ga Mu

Jim said:
Hello,

when i undef a anonymous hash that contains other anonymous hashes and areas, e.g.

$hashref = { a => 'a', b => { c => 'c' } };
undef $hashref;

will the undef also undef all data structures inside the tree of data?

much thanks,
Jim

$hashref is a scalar that has nothing to do with anything you're doing.
When referring to the entire hash, as in both lines above, you need to
use %hashref. Yes, the entire hash is undef'd.

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top