On Fri, Jul 11, 2003 at 02:17:52PM -0700, John W. Krahn wrote: > Rob Dixon wrote: > > sub pad_keys { > > foreach (keys %$ref) { > > pad_keys($ref->{$_}); > > next unless (my $new = $_) =~ tr/ /_/; > > if (exists $ref->{$new}) { > > warn "Padded key $new already exists"; > > } > > else { > > $ref->{$new} = delete $ref->{$_}; > > } > > } > > } > > Kevin and Rob, > > perldoc -q "add or remove keys from a hash" > > Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod > What happens if I add or remove keys from a hash while > iterating over it?
I believe that's referring to iteration with each(). Rob's subroutine is iterating over the temporary list returned by keys(), so it should be quite safe. -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]