The first part is just creating 3d arrays "biu(i,j,k)"...
If I understand you correctly the best way to do that is to construct them the same way you change them later.

I've used the perlish for loop and started at 0 (you'll need to correct the assignments at the end to match to avoid any off by 1 errors).

Data::Dumper helps to see what is going on.

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $u15 = 15; my $u105 = 105; my $u25 = 25; my (@biu); for my $k (0..11) { for my $j (0..25){ for my $i (0..25){ $biu[$k][$j][$i] = $u105; } } } my (@zcu); for my $k (0..11) { for my $j (0..25){ for my $i (0..25){ $zcu[$k][$j][$i] = $u15; } } } for my $k (0..12) { for my $i (0..5) { $biu[$i][4][$k] = $u25; } for my $i (21..25){ $biu[$i][4][$k] = $u25; } for my $i (0..4) { $biu[$i][22][$k] = $u25; } for my $i (21..25) { $biu[$i][22][$k] = $u25; } # } print Dumper \@biu;

In reply to Re: Help with multi-dimensional arrays (list of lists) by wfsp
in thread Help with multi-dimensional arrays (list of lists) by pattobw

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.