When you write the following:
$my_hash{"T::c"}
Perl interprets the hash key as the string T::c. The quotes are only there so that Perl knows that you mean the string T::c and not something that Perl could interpret as something else (like a package name, in this case).
Constructing a value that contains quotes will not make the lookup successful because the hash key as interpreted by Perl does not contain quotes.
To look at what Perl sees in a hash, consider using Data::Dumper:
use Data::Dumper;
my %my_hash = (
'"with_quotes_in_key"' => 'a value',
"without_quotes_in_key" => 'another value',
bare_key => 'a third value',
"T::c" => 'your value',
'"Another::thing"' => 'a fifth value',
);
print Dumper \%my_hash;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.