Thanks all for the suggestions,
 
I tried
$data =~ s/\r//g;
and also with \n.  Still the same output.  I outputted the string to a text file, and it is all in one line.  So, I'm still baffled to why it is printing in separate lines in HTML format and the "invalid data set" error when  I try to graph.
 
David
 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 12, 2005 5:20 PM
To: Hsu, David
Cc: activeperl@listserv.ActiveState.com
Subject: Re: String formatting

In a message dated 4/12/2005 3:56:43 P.M. Eastern Standard Time, [EMAIL PROTECTED] writes:
 
> 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 = "">> 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;
 
this a match, but not a substitution.   try ``$data =~ s/\r//g;'' (capturing parentheses are not needed).   also, the line break may a newline rather than a carriage return: try \n in place of \r.  

>
> Any insights?
> Thanks
> David
 
 
 
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to