--- loncom/debugging_tools/clean_db.pl 2006/06/27 14:35:24 1.3 +++ loncom/debugging_tools/clean_db.pl 2008/08/16 14:36:09 1.5 @@ -4,7 +4,7 @@ # # dump_db.pl - dump a GDBM database to standard output, unescaping if asked to. # -# $Id: clean_db.pl,v 1.3 2006/06/27 14:35:24 albertel Exp $ +# $Id: clean_db.pl,v 1.5 2008/08/16 14:36:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -65,14 +65,13 @@ if (! $dbref) { warn("Unable to tie to $fname"); exit; } -while (my ($key,$value) = each(%{$dbref})) { - if ($key ne $key_to_remove) { next; } - delete($dbref->{$key}); +if (exists($dbref->{$key_to_remove})) { + delete($dbref->{$key_to_remove}); if ($fname =~ m|/nohist_[^/]*.db|) { exit; } my $hist=$fname; $hist=~s/\.db$/.hist/; open(HIST,">>$hist"); - print HIST ("D:".time.":$key\n"); + print HIST ("D:".time.":$key_to_remove\n"); close(HIST); } exit;