Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 perusing the Monastery: (4)
As of 2015-07-02 03:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls