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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |