Greetings Monks

This is a foray into 3 dimensional data structures. The aoa in question is at the end, I can't seem to sort out my references and dereferences.Guidence is order,I'm not sure where this leads or how I am thinking incorrectly.
I also have a bit of confusion surounding strictures: Why does a scalar defreference of an array force declarations to be made on the scalar and the array with the scalar name?Seems redundant,but strict seems important in the future of my studies.
Thanks

#! /usr/bin/perl use strict; use warnings; #a plethora of my's ...strict baffles me my @contents; my @aoa; my @ctags; my @ctagarray; my @aoac; my @headc; my @contentc; my @fontc; my @scalarclose; my $ctag; my $font; my $head; my $content; my $val; my $newlength; my $count; my $scalarclose; my $headc; my $fontc; my $contentc; my $i; #two arrays of arrays to populate @aoa=qw/header font content/ ; @aoac=qw/headerc fontc contentc/; # array of array values @contents=( ["html","head","body",], ["font","face","size","color"], ["h1","p","code"] ); #scalar ref to array for later population $scalarclose=\@aoac; #populate the aoa for (0...$#aoa){ $aoa[$_]=$contents[$_]; } #use contents of populated aoa foreach $val(@aoa){ # an incrementer hacked to use for populating # an aoa with modified values ++$i; $count=$i-1; #get values from original aoa and modifiy, #begin population of new aoa our $length=scalar @$val; for (0...$length-1){ $ctag="<\\$val->[$_]>"; push @ctags ,$ctag ; } $newlength=$length+1; @ctagarray=splice @ctags,0,$newlength; #this line is problematic @$scalarclose[$count]=map {$_}, @ctagarray; } #scalar refs to aoa $headc=$aoac[0]; $fontc=$aoac[1] ; $contentc=$aoac[2]; #print to see the populus >>broken<< print " $headc->[1]\n"; print " $fontc->[1]\n"; print " $contentc->[1]\n";

In reply to Populating Arrays of Arrays by dReKurCe

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.