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
In reply to Re^3: Removing keys in the registry (code)
by tye
in thread Removing keys in the registry
by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |