Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: how to merge Hash

by Anonymous Monk
on Jun 10, 2012 at 12:31 UTC ( [id://975423]=note: print w/replies, xml ) Need Help??


in reply to Re: how to merge Hash
in thread how to merge Hash

can you please explain me the above code when you assigned the values of %hash2 to @hash1 how it is reflecting in %hash1

Replies are listed 'Best First'.
Re^3: how to merge Hash
by Anonymous Monk on Jun 12, 2012 at 08:38 UTC

    There is no array "@hash1" there is only the hash "%hash1".

    This is called a hash slice , and in a quirk of perl syntax uses the @ sigil instead of %

    my %foo; @foo{ 'hash', 'slices' } = ( 'use', 'curly braces' );

    my @bar; @bar[ 1,2,3,4 ] = ( 'array', 'slices', 'use', 'square brackets' );

    Say it with me:

    { 'hashes', 'are', 'curly', 'ones' }

    [ 'arrays', 'are', 'square' ]

    ( 'lists are round' )

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-04-18 20:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found