Please see haukex's detailed explanation here. Briefly, T::c (as a "bareword" literal, without any quotes) is not a "simple identifier"; it will not automatically be stringized to use as a hash key. On the other hand, anything that already is a hash key is a string; hash keys are always and can only be strings. Because hash keys are always strings, data serialization utilities like Data::Dumper will put quotes around them. (How a particular hash key got to be a string in the first place is another story.)
c:\@Work\Perl\monks>perl -wMstrict -MData::Dumper -le "my %my_hash; $my_hash{T::c} = 'xxx'; print $my_hash{'T::c'}; print Dumper \%my_hash; " Bareword "T::c" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. c:\@Work\Perl\monks>perl -wMstrict -MData::Dumper -le "my %my_hash; $my_hash{'T::c'} = 'xxx'; print $my_hash{'T::c'}; print Dumper \%my_hash; " xxx $VAR1 = { 'T::c' => 'xxx' };
Give a man a fish: <%-{-{-{-<
In reply to Re^5: hash key
by AnomalousMonk
in thread hash key
by aviw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |