in reply to Deleting undefined entries from DB_FILE hash
The problem is that the delete($hash{$key}) doesn't seem to actually be deleting the hash
How do you delete undefined hash key?
if hash key is not present, there is nothing to delete.
Don't you think so?
Peruse this:
but if you write this:use Data::Dumper; my $family={ father=>'foo', mother=>'bar',}; for(keys %$family){ if(!defined($_)){ delete $family->{$_} } } print Dumper $family; # print out your hash
I think you might have to look at your code construct again.use Data::Dumper; my $family={ father=>'foo', mother=>'bar',}; for(keys %$family){ if(defined($_)){ delete $family->{$_} } } print Dumper $family; # print empty hash
UPDATE:
Also in this:
Hope, $qdir is decleared somewhere in your code?my $file = sprintf('%s/%s/%02x.db', $qdir, $mypc, $i);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Deleting undefined entries from DB_FILE hash
by gossamer (Sexton) on Jul 23, 2012 at 02:49 UTC | |
by 2teez (Vicar) on Jul 23, 2012 at 03:19 UTC | |
by gossamer (Sexton) on Jul 23, 2012 at 13:07 UTC |