Mandrake has asked for the wisdom of the Perl Monks concerning the following question:
What I need is to change the key 'key1' to 'key2'. Offcourse this can be achieved by$hash{'key1'} = "Value1" ;
Is there any other way other than adding and deleting elements?$hash{'key2'} = $hash{'key1'}; delete $hash{'key1'} ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Modifying the keys in a hash
by Sidhekin (Priest) on Feb 23, 2007 at 10:10 UTC | |
by Mandrake (Chaplain) on Feb 23, 2007 at 11:24 UTC | |
|
Re: Modifying the keys in a hash
by sluap (Sexton) on Feb 23, 2007 at 14:22 UTC | |
by merlyn (Sage) on Feb 23, 2007 at 15:12 UTC | |
by sluap (Sexton) on Feb 23, 2007 at 15:44 UTC | |
by shmem (Chancellor) on Feb 23, 2007 at 16:58 UTC | |
by shmem (Chancellor) on Feb 23, 2007 at 14:37 UTC |