use Data::Dumper; my %hash = ( apple => 'red', orange => 'orange', banana => 'yellow', ); my $old_key = 'orange'; my $new_key = 'carrot'; $hash{$new_key} = delete $hash{$old_key}; print Dumper(\%hash);
In reply to Re^2: Hash substitution
by Narveson
in thread Hash substitution
by weezer_316
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |