Maclir has asked for the wisdom of the Perl Monks concerning the following question:
For example, if there is an entry "redirect_name" with a value of "boondoggle", I want to create a new entry "name" also with a value of boondoggle.
My code so far:
foreach $oldkey (keys %fdat) { if ( ($newkey = $oldkey) =~ s/^redirect_//) { $fdat{$newkey} = $fdat{$oldkey}; } }
At least it works. Any suggestions on ways to improve it?
tia.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regexs on Hash Keys
by merlyn (Sage) on Dec 01, 2000 at 02:28 UTC | |
|
Re: Regexs on Hash Keys
by Dominus (Parson) on Dec 01, 2000 at 03:49 UTC | |
|
Expressing Intent
by dws (Chancellor) on Dec 01, 2000 at 04:43 UTC | |
by Dominus (Parson) on Dec 01, 2000 at 05:00 UTC | |
by arturo (Vicar) on Dec 01, 2000 at 05:09 UTC | |
|
Re (tilly) 1: Regexs on Hash Keys
by tilly (Archbishop) on Dec 01, 2000 at 06:39 UTC | |
|
Re: Regexs on Hash Keys
by rpc (Monk) on Dec 01, 2000 at 02:30 UTC | |
|
Re: Regexs on Hash Keys
by mwp (Hermit) on Dec 01, 2000 at 02:39 UTC | |
by tye (Sage) on Dec 01, 2000 at 03:01 UTC | |
|
Re: Regexs on Hash Keys
by Maclir (Curate) on Dec 01, 2000 at 02:45 UTC |