EDIT: It was nearly 1 in the morning when I posted. Looking now, really against my better judgment. I was tired and frustrated.

I apologize, sometimes i forget that monks are mere mortals, not programing gods that can read my mind.

The advice to slow down and think goes a long way. I appreciate that greatly. I solved the one issue relating to getting the hash reference, but still have the issue with the flexible naming. See comments inside the code. I may have a solution, but I am not confident in it.

use Data::Dumper; use warnings; my @array_1 = (1 .. 10); my @array_2 = (1 .. 10); my $internal_hash_number = 2; for (1 .. $internal_hash_number) { my $internal_name = $_; my @hold_a; my @hold_b; my $min = 10; my $max = 50; for (1 .. 10) { my $internal_value_a = int rand($max - $min + 1) + $min; push(@hold_a, $internal_value_a); my $internal_value_b = int rand($max - $min + 1) + $min; push(@hold_b, $internal_value_b); } $internal_hash{$internal_name} = { "$internal_name\_a" => [@hold_a], "$internal_name\_b" => [@hold_b], }; } $storage_hash{1} = { holder => [@array_1], individual => [ @array_2 ], marker => [ %internal_hash ], }; print Data::Dumper->Dumpxs([\%storage_hash], [q{*storage_hash}]); #now: #this accesses the array within the hash: my @external_array = @{$storage_hash{1}{'holder'}}; print "@external_array\n"; #this accesses the hash within the hash: my %internal_hash_ref = @{$storage_hash{1}{'marker'}}; my $internal_ref_name = '1_a'; my @internal_array_ref = @{$internal_hash_ref{1}{$internal_ref_name}}; print "@internal_array_ref\n"; @internal_array_ref[1] = 20; print "@internal_array_ref\n"; $internal_hash_ref{1}{$internal_ref_name} = [@internal_array_ref]; print Data::Dumper->Dumpxs([\%internal_hash_ref], [q{*internal_hash_re +f}]); # This gives me the array back out that I can now do things with. # BUT I want to be able to have a code that is flexable... # 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. my $value = 0; for (1 .. $internal_hash_number) { $value++; my $safe_input = $value; print "$safe_input\n"; @{$safe_input}=(); push @{$safe_input}, @{$internal_hash_ref{1}{$internal_ref_name}}; print "@{$safe_input}\n"; } #do you monks think that this is a valid bit of code? #or should I not do it like this?
One other thing: I am however confused about the <TABS> how on earth do you read code that is not tabbed? I cant understand it, it looks like run on sentences to me. Though I am still new to this, maybe it comes with experience.

In reply to 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.