Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: how to avoid mis-spelling hash keys?

by perrin (Chancellor)
on Jan 05, 2003 at 21:50 UTC ( [id://224474]=note: print w/replies, xml ) Need Help??


in reply to how to avoid mis-spelling hash keys?

One very simple approach that works with older versions of Perl is to use lexical variables for your keys.

use strict; my $bar = 'bar'; my $foo{$bar} = 1; my $foo{$bear} = 1; # gives a compile error

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-24 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found