print "\nDelete children of $test :\n"; foreach $key (keys %index) { ... delete $index{$key}; }