in reply to use constant for strings

The constant you are assigning is WISCONSIN to WI not WI to WISCONSIN. That said there is also a difference between WI and "WI" as
use constant WI => "WISCONSIN"; use constant ILLINOIS => "IL"; my %capitol_map = ( WISCONSIN => "Madison", ILLINOIS => "Springfield", ); my $abbrev = WI; if ( exists $capitol_map{$abbrev} ) { print "capitol = $capitol_map{$abbrev}\n"; } else { print "False" }
will print the name of the capitol, and
use constant WI => "WISCONSIN"; use constant ILLINOIS => "IL"; my %capitol_map = ( WISCONSIN => "Madison", ILLINOIS => "Springfield", ); #THE LINE BELOW WAS CHANGED my $abbrev = "WI"; if ( exists $capitol_map{$abbrev} ) { print "capitol = $capitol_map{$abbrev}\n"; } else { print "False" }
will not.

update:Hrm.. maybe I missed the fact that the OP might have wanted the WISCONSIN in the hash to become WI not the WI in the my $abbrev to become WISCONSIN ... so my answer would then be incorrect as i seem to be answering the wrong thing.

-enlil