... After only 3 hours searching, finally found a mistake in my code ...

I am somewhat disappointed actually getting no warnings from the compiler - please consider the following code:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; $hash{'A'.'B'} = 1; # note a mistakenly written comma between 'C' and 'D' $hash{'C','D'} = 2; $hash{'E','F'} = 3; print Dumper(\%hash); print exists $hash{'CD'} ? "YES\n" : "NO\n";
And here is the output
$VAR1 = { 'CD' => 2, 'EF' => 3, 'AB' => 1 }; NO
My xterm shows nothing between C and D in the output from Dumper, but with hexdump i could see that there is actually HEX: '1c' there
24 56 41 52 31 20 3d 20 7b 0a 20 20 20 20 20 20 |$VAR1 = {. | 20 20 20 20 27 43 1c 44 27 20 3d 3e 20 32 2c 0a | 'C.D' => 2,.| 20 20 20 20 20 20 20 20 20 20 27 45 1c 46 27 20 | 'E.F' | 3d 3e 20 33 2c 0a 20 20 20 20 20 20 20 20 20 20 |=> 3,. | 27 41 42 27 20 3d 3e 20 31 0a 20 20 20 20 20 20 |'AB' => 1. | 20 20 7d 3b 0a 4e 4f 0a | };.NO.|
Any ideas, what's really happened? Why is it '1c' and not 'f5'? Is it a bug that perl produces no warnings in this case?

In reply to Comma Operator, BUG or feature ??? by nif

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.