in reply to modifie the first set of keys in a hash
My suggestion is to modify the things on output instead of modifying the things in your data structure. See for example Text::CSV_XS for how to write a (tab-separated) CSV file.