I thought you could assign a value to the hash like
$vHash{"101010"}{"S0"} = "sometext";
and then go on and assign an level of hash
$vHash{"101010USED"}{"S0"}{"SYSTEM"} = "sometext";
You can, but you probably shouldn't. The first example puts sometext (which you needn't double-quote, since you aren't interpolating) into the key SO (which you needn't quote at all, since hash keys auto-quote) of the anonymous hash that lives at key 101010 of %vhash. That is, this is the same as
${ $vHash{101010} }{S0} = 'sometext';
The second assignment treats $vHash{101010}{S0} $vHash{101010USED}{S0} as a hash by looking for its entry at key SYSTEM, so Perl obligingly makes it a hash. That is,
ref $vHash{101010}; # => 'HASH' ref $vHash{101010}{S0}; # => undef ref $vHash{101010USED}; # => 'HASH' ref $vHash{101010USED}{S0}; # => 'HASH'
While there's no need for the entries of a hash to be homogeneous—it's perfectly OK if some entries are hashes, some are hashes-of-hashes, and so on—it'll probably lead to confusion unless you really mean it.

UPDATE: As ikegami points out, one of the ways that it can confuse is that you can wind up treating a simple scalar as a (symbolic) hash reference, with the sort of unexpected results that you've discovered.


In reply to Re^2: Strange Hash Problem by JadeNB
in thread Strange Hash Problem by rpike

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.