The following code may be not simple: ===code=== #!/usr/bin/perl use warnings; use strict;
my %hash = ("abc"=>"mallik","xyz"=>"ariun","mno"=>"priya"); my %hash2 = ("abc"=>"123","xyz"=>"243","mno"=>"532"); foreach (keys %hash2) { $hash{$hash2{$_}} = $hash{$_}; delete $hash{$_}; } foreach (keys %hash) { print "$_ ==> $hash{$_}\n"; } ===code=== On Wed, 8 Jun 2005 14:02:51 +0530 "Mallik" <[EMAIL PROTECTED]> wrote: > Hi Thomas, > > Thanks for your reply. > > I want to accomplish some thing like this... > > %hash = ( > "abc" => "mallik", > "xyz" => "arjun", > "mno" => "priya" > ); > > Need be changed to > > %hash = ( > "123" => "mallik", > "243" => "arjun", > "532" => "priya" > ); > > The key value abc is changed to 123 and so on.. > > Hope my requirements are clear now. > > Any help in this regard is greatly appreciated. > > Thanks & Regards, > Mallik > > -----Original Message----- > From: Thomas B__tzler [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 08, 2005 11:50 AM > To: 'beginners@perl.org' > Cc: 'Mallik' > Subject: RE: How to change the value of a Hash Key > > Mallik <[EMAIL PROTECTED]> asked: > > > I have a below hash (printed using Dumper). > [...] > > Here, the key is 'Technologies':'Optical':'Dense Wavelength > > Division Multiplexing (DWDM)'. > > > > Now, I want to replace it with something like 'abc'. > > > > Any pointers on this? > > Did you mean something like this? > > $hash{'bar'} = $hash{'foo'}; > delete $hash{'bar'}; > > HTH, > Thomas > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- Whatever you do will be insignificant,but the important is you do it! It doesn't matter who you are, it's what you do that takes you far! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>