----- Original Message -----
From: "Hsu, David" <[EMAIL PROTECTED]>
To: "[EMAIL PROTECTED] "ActivePerl""
<[email protected]>
Sent: Monday, April 11, 2005 8:57 PM
Subject: String formatting
Hi all,
I am working with GD::Graph and I am retrieving some data from a DB and
formatting the data into a string that I can use for graphing.
my @data = ($data1);
My $myGraph = GD::Graph::lines->new(400,300);
...
The problem is that my formatted string of data is not in the correct
format and returns an error. I check the string printed to the screen
and it looks like this:
[-0.84,-0.83,-0.4,-0.39,-
0.39,1.16,2.38,4.49,7.08,10.07,13.14],
[1.09,0.47,-14.95,-47.63,-
5.75,30.19,21.07,37.63,57.18,84.63,118.59],
[0,0.06,-21.27,-59.79,-
11.11,22.26,12.67,15.25,10.79,6.58,4.52,4.05]
Invalid data set: 0 at c:\inetpub\wwwroot\trialmap\cgi-bin\eData.pl line
2106.
From my testing, the array needs the data to be either one line, or 3
lines separated by the brackets.
I am assuming they are return carriages, (but I am not sure why it is
there) so I try this RE to remove it, with no luck.
$data1 =~/(\r)//g;
Try
$data1 =~ s/\n//sg;
or
$data1 =~ s/[^\d,.]//sg;
Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs