http://qs321.pair.com?node_id=46961


in reply to Re: map it back jack
in thread map it back jack

Seems like you can save a couple of keystrokes if you're not particular about what ends up in $v, since s/// operates on $_:

my $v; my %myhash = map { $v = $_; s/_/ /g; $v, $_ } @elements;
Is there a way to pare it down more? (The Monastery needs a golf course!)

Update: As I0 points out, this also modifies @elements, which may not be what you want.

johannz's for construct is looking the most elegant to me now.