C: replace while each with for keys

Use of each() on hash after insertion without resetting hash iterator results in undefined behavior at blib/lib/B/C.pm line 5358