in reply to use constant for strings

UPDATE: i should have checked before i posted ... just do what merlyn said. :)

Nope, that's not how constants work. Actually, a constant is really a Perl sub that returns the 'constant' value. Try using another hash:

use constant WISCONSIN => "WI"; use constant ILLINOIS => "IL"; my %abbrev_map = ( WI => 'WISCONSIN', IL => 'ILLINOIS', ); my %capitol_map = ( WISCONSIN => "Madison", ILLINOIS => "Springfield", ); my $abbrev = "WI"; if ( exists $abbrev_map{$abbrev} ) { print "capitol = $capitol_map{$abbrev_map{$abbrev}}\n"; }
Alternatively ... i have a strong suspicion that a CPAN module might exist that contains states and their capitols.

UPDATE 2:
Well, can't seem to find one. The closest matches are:

which contain American states and their abbreviations, but no capitols .... hmmmm .... sounds like a new CPAN module is in the works.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)