in reply to Win32::TieRegistry - deleting values or keys with subkeys present.

Assigning a hash to a registry key will only create additional subkeys/values for thoses keys of the right hand side hash, that aren't already a subkey of the left hand side registry key.

It will not lead to the deletion of subkeys in the left hand side registry key.

for deleting a subtree you have to get rid of its subkeys, so that delete can proceed.

Recursively traversing the tree, would do the job.

# this is only pseudo code # refine and apply at your own risk (of damaging your Registry) sub delkey { my $key = shift; delkey($_) for grep isasubkey($_), keys %$key; delete $key; }

It's actually more difficult, since you have to make it delete $parent->{$keyname} as described in the docs.

Good luck!

Replies are listed 'Best First'.
Re^2: Win32::TieRegistry - deleting values or keys with subkeys present.
by Sioln (Sexton) on Jan 20, 2006 at 07:08 UTC
    As I've understood from your words - there is no way without recursion.
    Ok, I have a search subroutine - it helps me to enumerate subkeys & subnodes.

    Than you for answer.