in reply to How would I do an inplace edit, prepending '~foo' to every key of a hash? (was: How would I do an inplace edit, prepending)

Here's a solution that uses map:
use strict; my %hash = ( one => 'blah', two => 'echo', thr => 'aaaak', ); my %new_hash = map { ("~foo$_", $hash{$_}) } keys %hash;
  • Comment on Re: How would I do an inplace edit, prepending ~foo to every key of a hash?
  • Download Code

Replies are listed 'Best First'.
Re: Re: How would I do an inplace edit, prepending
by meonkeys (Chaplain) on Feb 09, 2001 at 04:08 UTC
    Beautiful. Simple. ++. Thanks!