in reply to map2 {} grep2 {} ...

You don't even use the key in
my %h_prefixed = map2 { ($_[0], "p".$_[1]) } %h;
You could do
my %h_prefixed = %h; $_ = "p$_" for values %h_prefixed;

Replies are listed 'Best First'.
Re^2: map2 {} grep2 {} ...
by BrowserUk (Patriarch) on Jul 14, 2011 at 16:48 UTC

    He *did* use the keys -- to construct the new hash.

    And you also used the keys, when you constructed the new hash.

    But you also used the values at point -- and then again when you modified them.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.