in reply to Possible for Map to create Hash of Hash?

Can I achieve a similar result using map?

sure, but why do you want to?

  • Comment on Re: Possible for Map to create Hash of Hash?

Replies are listed 'Best First'.
Re^2: Possible for Map to create Hash of Hash?
by konnjuta (Acolyte) on May 11, 2013 at 10:52 UTC
    I was fascinated with the Schwartzian transform and would like to learn more about list manipulation using functions like map
      untested
      my %hash = map { my @explicit = split //, $_; $explicit[0] => { $explicit[1] => 1 }; } <>;
        I don't believe this would work. Firstly,
        split //, $_
        returns a list of characters instead of a list of words. Secondly,
        $explicit[0] => { $explicit[1] => 1 };
        Will ensure the store(i.e the key) will only have the last product read from the input. Update: or As Rolf puts it succinctly key Collision of the top level hash.