in reply to Hashes: Deleting elements while iterating

You could replace
foreach $key (%index){ delete $index{$key} if ($key =~ /$test.+/); }

in the original code with a one-liner:

foreach (keys %index) { delete $index{$_} if /$test.+/ }
Where the keyword "keys" returns a list of all the hash keys. The new version does not generate warnings.