Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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?
[Discipulus]: anyway thanks! i've posted my font size suggestion anyway
[shmem]: Discipulus: but whence the question, may I ask?
[Discipulus]: silly curiousity .. being honest last night i was planning an obfu based on builtin func prototypes

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-05-23 10:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?