Hi,

Sorry, it is my bad with the explanation...

Basically, I am using the GD::Graph::Boxplot for creating a boxplot...  To do 
that, I need to pass in an array of arrays.  My problem is that it generates 
the graph but with a lot of warnings about "uninitialized" values that is in 
the boxplot.pm.  After looking into the code, I realized that the loop 
structure that the boxplot.pm is using is something like this:
for ($k ;defined $data_array[$i][$j][$k];$k++) {
   // do something with $data_array[$i][$j][$k].
}

Upon further inspection of the array that I passed into the call, I find out 
that for some reasons, my array's last couple of elements are "defined" but 
without any values.  My first thought was that somehow I might have did 
something like this in my code:
   data[0][1] = $yield; (where $yield was an undefined value).
So, I did a check on $yield value first before assigning it...  That didn't 
seem to solve the problem...  My next assumption is that maybe I somehow 
"skipped" over some of the elements like so:
   data[0][1] = $yield;
   data[0][100] = $yield;
where the middle 99 elements were unassigned and that perl automatically 
defined them.  I used print statements and didn't seem to notice this problem...

The actual code is very long; I will try to see if I can replicate the problem 
using a simplier version....

Thanks.....

--Chung






-----Original Message-----
From: Offer Kaye [mailto:[EMAIL PROTECTED]
Sent: Sat 5/21/2005 1:59 AM
To: Perl Beginners
Subject: Re: undefined...
 
On 5/21/05, Ley, Chung wrote:
> Hi,
> 
> I have a piece of code which generates array of arrays which then is used to 
> call the 
> GD::Graph::Boxplot...
> 
> For some reasons, I would have elements that is defined but has not value.  I 
> have been 
> going thru the code to see if I had accidentally assigned null values or if I 
> had 
> accidentally do something like:
>         data[0][1] = 1;
>         data[0][100] = 100;
> without defining the 99 elements within the range; but it doesn't seem to be 
> the case....
> 

You can use the "defined" function to check if a value is 'undef" or
not. Read "perldoc -f defined" from your command-line, or online at:
http://perldoc.perl.org/functions/defined.html

> Does someone has some suggestions as to how to debug this?
> 

Debug what? Show us some code, explain exactly what you were expecting
and what the problem is, and *then* we can help.

HTH,
-- 
Offer Kaye

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to