Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Using Number Ranges in a Dispatch Table

by planetscape (Chancellor)
on Feb 18, 2012 at 19:32 UTC ( #954788=note: print w/ replies, xml ) Need Help??


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

Bless you!

I thought the technique itself should be sound, and the solution something simple, but I didn't realize it would be this simple!

Thanks!

HTH,

planetscape


Comment on Re^2: Using Number Ranges in a Dispatch Table
Replies are listed 'Best First'.
Re^3: Using Number Ranges in a Dispatch Table
by Anonymous Monk on Feb 18, 2012 at 19:36 UTC
    No need to double up on the parentheses
    (map { $_ => 2 } 'B','C'), (map { $_ => 3 } 'D','E'),
      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
Node Status?
node history
Node Type: note [id://954788]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (17)
As of 2015-07-28 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls