Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: map2 {} grep2 {} ...

by ikegami (Patriarch)
on Jul 14, 2011 at 16:37 UTC ( [id://914386]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://914386]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2024-04-18 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found