Miguel has asked for the wisdom of the Perl Monks concerning the following question:
What am I missing here:
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; my @data = [ '17-02-2005','18-02-2005','19-02-2005', '20-02-2005','21-02-2005','22-02-2005', '23-02-2005','24-02-2005' ]; my %labels = ( 'C' => [0,0,0,0,7,0,0,2], 'A' => [0,0,0,0,0,0,5,4], 'B' => [0,0,0,0,0,0,0,0] ); foreach my $item (sort {$a cmp $b} keys %labels) { push @{$data[$item]}, $labels{$item}; } use Data::Dumper; print Dumper @data; __OUTPUT__ $VAR1 = [ '17-02-2005', '18-02-2005', '19-02-2005', '20-02-2005', '21-02-2005', '22-02-2005', '23-02-2005', '24-02-2005', [0,0,0,0,0,0,5,4], [0,0,0,0,0,0,0,0], [0,0,0,0,7,0,0,2] ];
Altought the output is what I want, I get these errors:
Argument "A" isn't numeric in array element. Argument "B" isn't numeric in array element. Argument "C" isn't numeric in array element.
What am I doing wrong this time?
Thanks,
Miguel
UPDATE Damn it! I posted this message at the wrong place! Sorry for this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pushing at Array of Arrays
by rir (Vicar) on Feb 25, 2005 at 02:24 UTC | |
by Miguel (Friar) on Feb 25, 2005 at 11:50 UTC | |
|
Re: Pushing at Array of Arrays
by Enlil (Parson) on Feb 25, 2005 at 01:50 UTC | |
|
Re: Pushing at Array of Arrays
by djantzen (Priest) on Feb 25, 2005 at 01:41 UTC | |
|
Re: Pushing at Array of Arrays
by sh1tn (Priest) on Feb 25, 2005 at 00:59 UTC | |
by djantzen (Priest) on Feb 25, 2005 at 01:46 UTC |