NAME Hash::Rename - Rename hash keys SYNOPSIS use Hash::Rename; my %hash = ( '-noforce' => 1, scheme => 'http' ); hash_rename %hash, code => sub { s/^(?!-)/-/ }; DESCRIPTION Using this module you can rename a hash's keys in place. FUNCTIONS hash_rename This function is automatically exported. It takes a hash to rename and another hash of instructions on how to rename they keys. The syntax is like this: hash_rename %hash, instruction1 => 'value1', instruction2 => 'value2'; The following instructions are supported: "prepend" hash_rename %hash, prepend => '-'; The given value is prepended to each hash key. "append" hash_rename %hash, append => '-'; The given value is appended to each hash key. "code" hash_rename %hash, code => sub { s/^(?!-)/-/ }; Each hash key is localized to $_ and subjected to the code. Its new value is the result of $_ after the code has been executed. "strict" If present and set to a true value, the resulting keys are checked for duplicates. "hash_rename()" will die if it detects a duplicate resulting hash key. They keys of the hash to change are processed in alphabetical order. "recurse" Each hash value that is itself a hash reference is renamed with the same arguments as the original hash. If several instructions are given, they are processed in the order in which they are described above. So you can have: hash_rename %hash, prepend => '-', append => '='; AUTHOR The following person is the author of all the files provided in this distribution unless explicitly noted otherwise. Marcel Gruenauer , CONTRIBUTORS Masayuki Matsuki (@songmu) added the "recurse" option. COPYRIGHT AND LICENSE The following copyright notice applies to all the files provided in this distribution, including binary files, unless explicitly noted otherwise. This software is copyright (c) 2014 by Marcel Gruenauer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.