in reply to Re^3: map and grep (but for hashes)
in thread map and grep (but for hashes)
Oh, there probably is. I could one-line the above with not much work if I really wanted to. It would just be ugly.
Hmm, thinking about map... I'm not completely sure this would work, but I think it would: (I'm assuming you want to modify the values.)
@new_hash{keys %hash} = map { mod_func($hash{$_}) } keys %hash;
(This assumes the two invocations of 'keys' will be stable, which I'm not sure you can rely on.)
|
|---|