On Wed, Dec 07, 2005 at 09:39:45AM -0500, Alex Brelsfoard wrote:
> my $ds=1; # dataset counter
> # go through each dataset one at a time.
> foreach my $dataset(split(/::/, $param{'x'})) {
> my $i=0;
> # Go through each item in the dataset
> foreach my $num (split(/,/, $dataset)) {
> $data[$ds][$i++] = $num;
> }
> $ds++;
> }
>
> For the sake of making things easier, let's say that each dataset has
> exactly 10 integers separated by commas, and there are 2 datasets. So
> $param{'x'} would look something like this:
> "1,2,3,4,5,6,7,8,9,10::13,12,10,8,8,6,4,3,1,0"
The code seems to work fine for me, but I wonder why you don't just do
this:
foreach my $dataset (split /::/, $param{'x'}) {
push @data, [split /,/, $dataset];
}
> I get a broken image when I try to execute this (with the rest of the code
> listed below). If I manually setup @data it works fine. But if I try to us
> the data sent to the script, then it doesn't work.
> I have tested @data to make sure that my info is being stored; I simply do a
> print statment and take a look at specific spots in @data, like
> $data[1][4]. It it DOES print out the correct value '5'.
> I've tried several methods, but for some reason I can't seem to put the data
> in correctly.
If you're only looking at specific spots in @data, then you could be
overlooking where the actual problem is. I'd suggest doing a dump of @data
with Data::Dumper or Data::Dump.
I'd also check for errors and warnings from the script, either in the web
server logs or by running the script from the command line.
Ronald
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm