Thanks...

I didn't know the use of Data::Dumper, wish I had known it earlier...  
Basically, I was trying to mimic what the Boxplot.pl was doing, and so I did a 
loop like this:
        for (my $k; defined $data[0][1][$k]; $k++ )
        {
                print "data[0][1][$k] is defined\n";
                print "data[0][1][$k] = $data[0][1][$k];\n";          
        }
I discovered that I have a number of elements that are defined but with no real 
values....

I have never used the "Devel-ebug" before, I will try to learn...

But in trying to "replicate" the same problem, I seem to find something that is 
odd...  Basically, instead of "looping" thru all the data, I mimic the same 
place where I am having the problem by "hard-coding" the data array for just 
ONE very simple boxplot based on real data(see later).  The code works when I 
put it in its own file - no warnings...  But it doesn't work when I am running 
it in my "main" program!  The warnings are something like these:
Use of uninitialized value in array element at 
/usr/lib/perl5/site_perl/5.8.0/GD/Graph/boxplot.pm line 470.
Use of uninitialized value in array element at 
/usr/lib/perl5/site_perl/5.8.0/GD/Graph/boxplot.pm line 472.
Use of uninitialized value in numeric gt (>) at 
/usr/lib/perl5/site_perl/5.8.0/GD/Graph/boxplot.pm line 472.
...
...

So, I was curious...  Basically, I then "move" this hardcoding to the "very 
beginning" of my main program BEFORE even my variable declarations and etc, and 
it still had the same warnings!!!  I am dumbfounded...  I am thinking that 
somehow maybe the perl compiler/interpreter is doing some optimzation that is 
different when the "size" of your perl program is at a different size????

--cley


First Code 
sampe::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#!/usr/bin/perl
$| = 1;       # AutoFlush

use strict;
use warnings;
use DBI;
use GD;
use Benchmark;
use POSIX;
use TSGPlot;

    my (@data, $ret);
        $data[0][0] = 'AMD133';
        push (@{$data[1][0]}, 97.6);
        push (@{$data[1][0]}, 97.5);
        push (@{$data[1][0]}, 98.4);
        push (@{$data[1][0]}, 96.4);
        push (@{$data[1][0]}, 95.5);
        push (@{$data[1][0]}, 97.1);
        push (@{$data[1][0]}, 97.5);
        push (@{$data[1][0]}, 100.0);
        push (@{$data[1][0]}, 98.4);
       $ret = boxplot('data'       => [EMAIL PROTECTED],
                           'output'     => 'abc.png',
                           'title'      => 'Class Yield vs Testers',
                           'x_label'    => 'Testers',
                           'y_label'    => 'Class Yield'
                           );
    die();





 

-----Original Message-----
From: Offer Kaye [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 22, 2005 12:56 AM
To: Perl Beginners
Subject: Re: undefined...


On 5/22/05, Ley, Chung wrote:
> 
> 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...
> 

(nipicking - you wrote "data[0][1]" without the $ sign before "data".
Try to be exact when posting your code, it might make you think of
something you forgot in your code.)

How did you use print statements? Did you use Data::Dumper? Try:
   use Data::Dumper;
   print Dumper ([EMAIL PROTECTED]);
Just before you pass @data to GD::Graph::Boxplot. You should see which
values are undefined, although perhaps that will not help you to
understand why they are not defined.
You might also want to try out the Devel::ebug module, it's very nice :)
http://search.cpan.org/dist/Devel-ebug/

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>





--
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