You shouldn't overwrite you post. Anyone looking at this thread now won't understand the comments that have been made. You should post a new note in the thread with your new code and add a comment to your original post explaining that you have posted new a note (perhaps with a link to the new note).

You still haven't added

use strict;
to the top of your code. If you had you would have seen that it is still throwing errors.

Declaring all your variables fixes most of them. There was a syntax snag (not exactly an error)

#@internal_array_ref[1] = 20; # better as $internal_array_ref[1] = 20;
As to the question at the end of the script.
I want to be able to have a code that is flexible. So that I can change the number of internal_hash_number and the code will be smart enough to name the array based on what it is called in the hash.
In the hash you are looking at you have primary and secondary keys. Each secondary key points to an array ref. You can iterate over it by
for my $key_primary (keys %internal_hash_ref) { print qq{primary key: *$key_primary*\n}; for my $key_secondary (keys %{$internal_hash_ref{$key_primary}}){ print qq{\tsecondary key: *$key_secondary*\n}; print qq{\t\t*@{$internal_hash_ref{$key_primary}{$key_secondary}}* +\n}; } }
output:
primary key: *1* secondary key: *1_b* *34 33 49 32 46 47 27 31 46 30* secondary key: *1_a* *44 20 20 32 32 47 39 35 24 41* primary key: *2* secondary key: *2_a* *34 23 24 30 10 38 47 23 17 25* secondary key: *2_b* *45 47 44 44 45 39 13 35 14 23*
So, @{$internal_hash_ref{$key_primary}{$key_secondary}} is the name of the array. If this isn't what you want you will have to explain a bit more what it is you want to do with this "named" array.

Don't overwrite your posts and use strict and warnings.

Good luck!


In reply to Re: HwithinHoA? Complex Data Structure...I am so lost... by wfsp
in thread HwithinHoA? Complex Data Structure...I am so lost... by BioNrd

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.