Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Using Number Ranges in a Dispatch Table

by Anonymous Monk
on Feb 18, 2012 at 19:36 UTC ( [id://954789]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using Number Ranges in a Dispatch Table
in thread Using Number Ranges in a Dispatch Table

No need to double up on the parentheses
(map { $_ => 2 } 'B','C'), (map { $_ => 3 } 'D','E'),

Replies are listed 'Best First'.
Re^4: Using Number Ranges in a Dispatch Table
by ForgotPasswordAgain (Priest) on Feb 19, 2012 at 01:27 UTC
    If we're being nitpicky :) no need to create a lexical block for map:
    $ perl -Mstrict -MData::Dumper -we'my%h=( (map +($_=>2), "B","C","D"), + one=>1 ); print Dumper(\%h)' $VAR1 = { 'one' => 1, 'D' => 2, 'C' => 2, 'B' => 2 };

Log In?
Username:
Password:

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

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

    No recent polls found