delete $h{$_} for (grep {ref $h{$_}} keys %h);