Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Concerning hash operations (appending, concatenating)

by manav (Scribe)
on Mar 24, 2005 at 16:53 UTC ( #442114=note: print w/ replies, xml ) Need Help??


in reply to Concerning hash operations (appending, concatenating)

The above solutions rely on interpreting the hash in a list context, in which it returns all its key value pairs flattened out. for eg, see the below code

use strict ; use warnings ; my %hash=('a'=>'b','c'=>'d') ; my @arr=(%hash) ; local $"="|" ; print "@arr" ;
which spews out
a|b|c|d
Now,
(%hash,'e'=>'f')
flattens out the key value pairs of %hash into a list. Hence it reduces to
('a'=>'b','c'=>'d','e'=>'f')
So on and so forth for code like
(%hash1,%hash2)


Manav


Comment on Re: Concerning hash operations (appending, concatenating)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2014-12-25 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls