Hi,

I'm a beginner at PERL.  I've used it on and off, but only
just recently got myself back into the picture.  I figured
that if you forget something in PERL, it'd be easy to take
it up again.  So far, I'm not too sure of the ease
of taking up PERL again.  Before, I made a few perl scripts.
Now, when I look back, I find the whole thing overwhelming.
Even with comments...Anyway, I digress..

I have a text file with each line of the following format:

string1 string2 val1 val2 val3

I'm trying to read it into an array of arrays so I can
stick it in the creategraph() function to create a  line
graph.

So far, if I specifically create an array constant:

ie.

my(@data) = ( ["test 1",0.34,0.56,0.33],
                ["test 2",0.44,0.55,0.22],
                 ["final test",0.67,0.22,0.54])

my($grp) = new GD::Graph::linespoints();

and then put that in the $grp->plot([EMAIL PROTECTED]) function, I get
a graph.

But, if I use the following code:

while (<MYFILE>){
      chomp($_);
      @info = split(" ",$_);
      my($strngval) = "\"$info[0] $info[1]\"";
      $strval = "$strval,$strngval";
      $m1vals = "$m1vals,$info[2]";
      $m2vals = "$m2vals,$info[3]";
}

my (@sv) = split(",",$strval);
my(@m1) = split(",",$m1vals);
my(@m2) = split(",",$m2vals);

my(@data) = (@sv,@m1,@m2);

Are @sv, @m1 and @m2 all arrays?  So, would @data be an
array of arrays?  Or are the @sv, @m1 and @m2 arrays
flattened out, making @data just an array?

The thing is, with the fixed way of doing the graph,
and when I print out @data, I get

ARRAY(....) ARRAY(....) ARRAY(...)

But with the 'dynamic' way, I just get
ARRAY(...)

where (....) are memory locations in Hex, I believe.

Can someone point out what I'm doing wrong?

Thanks

E




-- email: [EMAIL PROTECTED] | "A man who knows not where he goes, | knows not when he arrives." | - Anon


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to