Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Having a problem creating a hash with the map function

by tobyink (Abbot)
on Nov 29, 2012 at 17:05 UTC ( #1006306=note: print w/replies, xml ) Need Help??


in reply to Having a problem creating a hash with the map function

Well, the contents of your map block indicate that you don't understand map much. It needs to return something (but cannot use the return keyword!). You have the for loop as the last statement in the block, which returns undef.

# Try something like... # %hashmap = map { my ($city, @dealers) = @$_; $city => {map { $_ => 1 } @dealers}; } @car_city_dealer_aoa; print Dumper(\%hashmap);
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006306]
help
Chatterbox?
[Eily]: make them wear gloves because if they leave fingerprints they have the right to ask you to dispose of the bulb at any time
[Corion]: marto: Heh - on the other hand, that's quite good IMO, as home automation information shouldn't leave the home network anyway...
[Corion]: Also, Twitter now seems to work with JS disabled... It asks me if I want to go to the Twitter legacy version. Progress?!
[marto]: Corion agreed RE home automation, but that's not what people bought into
[Corion]: marto: Yes, they were left in the dark about that :-D
[Corion]: I heard a good analogy to the GDPR, which likely only works for Germans. GDPR is the new "separating your thrash", which is common in Germany. I equate "sharing" data with littering - and likely the fight will also take 30+ years for data sharing to ...
[Corion]: ... become as socially inacceptable as littering is today

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2018-05-25 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?