Hi Monks!
Need to associate these values, I guess by the "ACCOUNT" value in each array, but I can’t figure it out the best way to do it.
#!/usr/bin/perl use strict; use warnings; use HTML::Template; use Data::Dump 'pp'; use Data::Dumper; my @princ; push @princ, ( {ACCOUNT=>'accountOne',NAME=>'name1',QDT=>'qdt1'}, {ACCOUNT=>'account2',NAME=>'name2',QDT=>'qdt2'}, {ACCOUNT=>'account3',NAME=>'name3',QDT=>'qdt3'}, ); my @type = (); push @type, ( {HOME_NUMBER=>'house for first account',YEAR=>'year for +forst account',MONTH=>'the month for the first account', ACCOUNT=>'ac +countOne',}, {HOME_NUMBER=>'house sec account',YEAR=>'year for the second +',MONTH=>'month for the second', ACCOUNT=>'account2',}, {HOME_NUMBER=>'house for the 3rd account', YEAR=>'year for 3 +',MONTH=>'month for the third', ACCOUNT=>'account3',}, ); my @person = (); push @person, ( {PERSON_ID=>'this is the id for the first account',PE +RSON=>'and the person for the first account',DATE=>'also the date for + the first account', ACCOUNT=>'accountOne',}, {PERSON_ID=>'id for the sec2',PERSON=>'This is the person2',DA +TE=>'The date forthe sec', ACCOUNT=>'account2',}, {PERSON_ID=>'The id3',PERSON=>'person data for the third acc', +DATE=>'The date matches the Third account', ACCOUNT=>'account3',}, ); my @data=(); my @n_type=(); my @n_person=(); my $n; for my $p (@princ){ ++$n; # In this block, I am stuck for my $i (1..$n){ push @n_type, \@type; push @n_person, \@person; }; push @data, { PRINC =>1,PRINC_DATA => [$p], TYPE =>1,TYPE_DATA => \@n_type, PERSON=>1,PERSON_DATA=> \@n_person }; } # Create and Load Template my $template_tmpl = HTML::Template->new( filehandle => \*DATA, die_on_ +bad_params => 1); $template_tmpl->param( DATA => \@data ); ...

Thanks for looking!

In reply to Associating values in Arrays by Maresia

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.