in reply to hash key
If $var contains double quotes, then your code will be accessing a hash key that also contains double quotes.
If you write $my_hash{"T::c"}, then Perl sees a double-quoted string as the hash key, but the value of the double quoted string is the string without the surrounding quotes. As an alternative, you can also see that it works the same with single quotes $my_hash{'T::c'} or alternative quotes $my_hash{qq(T::c)}.
Your variable $var is equal to '"T::c"' as you already write, but in Perl source code, (double) quotes do not show up in the values they surround.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hash key
by thanos1983 (Parson) on May 30, 2017 at 11:49 UTC | |
|
Re^2: hash key
by aviw (Acolyte) on May 30, 2017 at 11:40 UTC | |
by Corion (Patriarch) on May 30, 2017 at 11:47 UTC | |
by aviw (Acolyte) on May 31, 2017 at 05:42 UTC | |
by AnomalousMonk (Archbishop) on May 31, 2017 at 07:10 UTC | |
by haukex (Archbishop) on May 31, 2017 at 13:49 UTC |