in reply to Maximum sub-arrays?

I would look to a data problem. Such as the sub-arrays not being uniform in length.

I have successfully managed to get GD to produce working bar graphs with hundreds of data points. Other than having to be careful about what order the bars got drawn in, there weren't any major glitches.

Replies are listed 'Best First'.
Re: Maximum sub-arrays?
by cwalck (Initiate) on Feb 29, 2004 at 19:38 UTC
    Everyone, thanks for your help. The problem lied in the fact that I had empty sub-arrays. I was trying to anticipate the number of unique viruses coming in. Sometimes I guess right, others not. All I needed to do was start with an array X and then push a new array on to X for each name in the database.
    my @dbData; while (@names = $day->fetchrow_array()) { $name = $names[0]; push my @virus, [@dbData]; }
      Looking at your code:
      my @dbData; while (@names = $day->fetchrow_array()) { $name = $names[0]; push my @virus, [@dbData]; }

      Where did you initialize the values for @dbData? I suspect you wanted something like this instead:
      my @virus = (); while (my @names = $day->fetchrow_array()) { push @virus, [ $name[0] ]; }

        No, later in program (after all of the arrays have been created) the following is in a loop:
        push @{ dbData[$index] }, $somevalue;
        The  $name=$name[0] line is misleading and shouldn't have been included in my snippet.