in reply to Re^2: Removing keys in the registry (code)
in thread Removing keys in the registry
what does the eval do ?
If a registry key contains values, then keys will return the names of those values. But $key->{$aValueName} will not give you back a hash reference so the %{$key->{$name}} would fail with "Can't coerce array into hash" or something.
sub deleteReg { my( $key, $name )= @_; for( eval { keys %{$key->{$name}} } ) { deleteReg( $key, "$name\\$_" ); } delete $key->{$name}; }
The eval will return what keys returns if $name is a subkey name and will trap the die and return and empty list if $name is a value name. So for( eval ... ) will silently skip values.
Also after executing this code i end up with a default value in the hive and can't find a way to delete it ?!
You can't have a registry key without an empty default value. That is just the way the registry is.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Removing keys in the registry (code)
by ZlR (Chaplain) on Sep 02, 2005 at 08:50 UTC | |
by tye (Sage) on Sep 02, 2005 at 22:51 UTC |