perl to display a matrix report for 3-dimenional array

tindavid used Ask the Experts™
Hi All,

@arrayTime = [time1, time2, time3, ......]   where time value has format like 20150710 10:24:10
@arrayID = [ id1, id2, id3, id4, .......  id15]            
@arrayPrice = [  Value1, Value2, Value3 ..... Value15]

I will like to produce a Matrix Report like below

                  id1              id2             id3 .......                id15
time1        value11     value21     vaue31                 value151
time2        value21     value22 ....


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Please provide more information.

You show @arrayPrice as having 15 values which your desired output shows as enough values to populate only one time row.  Where are the other values coming from?

In order to relate a value to a time and id, there must be some way to relate them.  Since @arrayID and @arrayPrice both have 15 values, I'm assuming the ordering of values matches the ordering of ids - is that correct?  How do you know which time the values relate to?
Most Valuable Expert 2014
Top Expert 2015
use warnings;
no strict "subs";
my @arrayTime = (time1, time2, time3);
my @arrayID = ( id1, id2, id3, id4, '.......',  id15);
my @arrayPrice = (
 [qw(value11     value21     vaue31                 value151)],
 [qw(value21     value22 .... )],
use strict;
print "\t@arrayID\n";
print "$arrayID[$_]\t@{$arrayPrice[$_]||[]}\n" for 0..$#arrayTime;



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial