in reply to Re^2: Adding an element of an array as a key for a Hash, and remaining elements as its value (would also be a hash)
in thread Adding an element of an array as a key for a Hash, and remaining elements as its value (would also be a hash)

... something that I have to learn about these braces

    $MasterHash{$mvr} = { map { split /:/; } @array1 };
                        ^     ^            ^         ^
                        |     |            |         |
                        |     + sub block  +         |
                        |                            |
                        + anon hash ref constructor  +
See perlref for anonymous reference constructors (in particular, Making References section 3 for the anon hash ref constructor) and also perlreftut. See map for the function of the sub(routine) block.


Give a man a fish:  <%-{-{-{-<

  • Comment on Re^3: Adding an element of an array as a key for a Hash, and remaining elements as its value (would also be a hash)
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: Adding an element of an array as a key for a Hash, and remaining elements as its value (would also be a hash)
by abhiram10 (Initiate) on Apr 12, 2016 at 03:21 UTC

    Thank you very much AnomalousMonk. I will do some reading and understand deeper. This is very useful. I appreciate your time and efforts to explain it to me!