leocharre has asked for the wisdom of the Perl Monks concerning the following question:
Ok.. I have a hashref..
my $h = { mm => 'July', yyyy => '1975', dd => '31', name => 'Milo', last_name => 'Manara', };
And I want to rename some of the keys. So that I end up with:
my $h = { month => 'July', year => '1975', day => '31', first_name => 'Milo', last_name => 'Manara', };
What's a classy way to do that? something using tr// ?? I'm at a loss on how, without building another structure..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: can i rename hashref keys?
by moritz (Cardinal) on Nov 29, 2007 at 17:01 UTC | |
by dave_the_m (Monsignor) on Nov 29, 2007 at 17:09 UTC | |
by lodin (Hermit) on Nov 29, 2007 at 17:24 UTC | |
by tye (Sage) on Nov 29, 2007 at 17:42 UTC | |
by Anonymous Monk on Nov 29, 2007 at 17:36 UTC | |
|
Re: can i rename hashref keys?
by kyle (Abbot) on Nov 29, 2007 at 17:22 UTC | |
|
Re: can i rename hashref keys?
by roboticus (Chancellor) on Nov 29, 2007 at 18:26 UTC |