NAME
SHARYANTO::Hash::Util - Hash utilities
VERSION
version 0.62
SYNOPSIS
use SHARYANTO::Hash::Util qw(rename_key);
my %h = (a=>1, b=>2);
rename_key(\%h, "a", "alpha"); # %h = (alpha=>1, b=>2)
FUNCTIONS
rename_key(\%hash, $old_key, $new_key)
Rename key. This is basically $hash{$new_key} = delete $hash{$old_key}
with a couple of additional checks. It is a shortcut for:
die unless exists $hash{$old_key};
die if exists $hash{$new_key};
$hash{$new_key} = delete $hash{$old_key};
None are exported by default, but they are exportable.
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.