Assume I have a muti-level hash:
$class->{'key1'}->{'key2'}->{$key3}->{'string'}->{$key5},
where $class->{'key1'}->{'key2'}->{$key3}->{'string'}->{$key5}
equals to some integer number.
$key3 can be class name like "music", "english"...
$key5 can be student name like "mary", "luke"...
Will the following operation release all the memory under level $key3="music"
?
i.e. will the memory assigned to $key5
be released?
$current_class = $class->{'key1'}->{'key2'}->{"music"};
$current_class = undef;
Update:
thanks both. My understanding between delete
and undef
is: delete
will remove the entry of key='music'
so $class->{'key1'}->{'key2'}->{"music"}
will not exist. while undef
will set value of $class->{'key1'}->{'key2'}->{"music"}
as undef
. but entry of key='music'
is still there but the value of it will be undef
so $class->{'key1'}->{'key2'}->{"music"} = undef
.
so I should delete the entry, is it correct?
but do you mean
undef $class->{'key1'}->{'key2'}->{"music"};
and
$class->{'key1'}->{'key2'}->{"music"} = undef;
are different?