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

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2015-11-26 19:57 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (706 votes), past polls