Save a list of keys into array and iterate over those because otherwise Perl 5.18 complains that "Use of each() on hash after insertion without resetting hash iterator results in undefined behavior"
Wrap arrayref in @{ } because otherwise Perl 5.19 complains that "push on reference is experimental"