Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Perl Idioms Explained - keys %{{map{$_=>1}@list}}

by dragonchild (Archbishop)
on Aug 04, 2003 at 14:06 UTC ( #280681=note: print w/ replies, xml ) Need Help??


in reply to Perl Idioms Explained - keys %{{map{$_=>1}@list}}

Along similar lines, I will often create a hash of keys which are needed for lookup. For example, I will do:

my %acceptable_server = map { $_ => 1 } qw( DEV QA PROD );
It's a nice way of working with a changing list of static acceptable things.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


Comment on Re: Perl Idioms Explained - keys %{{map{$_=>1}@list}}
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2014-11-28 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (199 votes), past polls