Perl is treating '512_x64' as an expression, where 'x' is the x operator. See the output from the following:
perl -MO=Deparse -e "$h{512_x64} = 10; print $h{512_x64}, qq/\n/;"
Though the syntax checks out 'ok', deparse makes it clear that Perl is seeing "512_x64" as the expression, 512 x 64.
As a refresher, 512 x 64 is the same as 512512512512512512512512...... where the sequence '512' is repeated 64 times. This is an unusual case where 512_ is treated as a number. Consequently the '_' is silently dropped, and then the
, the => operator has the effect of wrapping "512_x64" in single quotes, so on that line you are properly populating the hash. But later on when you recall the hash value, the interpretation of $h{ ...... } is not protected by single quotes, explicitly or implicitly.x</x> operator stringifies it, so that the number 512 is stringified a +nd repeated 64 times.</p> <p>In your definition (ie, <c>%h = ( 512_x64 => 'value' );
Dave
In reply to Re: Hash keys not DWIMming
by davido
in thread Hash keys not DWIMming
by syphilis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |