Thanks Andrew for the pointer to the Devel::Peek module. I didn't know about this module. <div><br></div><div>I had also found that Data::Dumper did very subtly show a difference between a value internally stored in Perl as a string or as a number. In the two dump snippets shown below, the numeric value is unquoted, and the string value is single quoted. For my purposes, I added zero (+ 0) to my values before putting them into the data structure that I was passing to the "to_json" call. This produced the JSON string I needed without the double quotes. Now my jQuery flot charts work perfectly. </div>
<div><br></div><div>Thanx for the help!</div><div><br></div><div><br></div><div><div>'data' => [ 'data' => [</div><div> [ [</div><div> 0, '0',</div>
<div> '31.3794' '31.3794'</div><div> ], ],</div><div> [ [</div><div> 1, '1',</div>
<div> '57.6309' '57.6309'</div><div> ], ],</div><div> [ [</div><div> 2, '2',</div>
<div> 0 '0.0000'</div><div> ], ],</div><div> [ [</div><div> 3, '3',</div>
<div> '40.0247' '40.0247'</div><div> ], ],</div><div><br></div></div><div><div><br></div><br><div class="gmail_quote">On Sat, Oct 3, 2009 at 1:50 AM, Andrew Rodland <span dir="ltr"><<a href="mailto:andrew@cleverdomain.org">andrew@cleverdomain.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">"x" in the debugger doesn't show it, but I would bet that JSON is keying on<br>
the magical, mostly-hidden type ("OK") flags of scalars. If you do $a =<br>
"12.34", $a has a valid string value but not a valid numeric value. If you<br>
calculate $a + 0, $a now has a valid string value *and* a valid numeric value,<br>
until it's changed by either a string operation or a numeric operation (at<br>
which point the value that wasn't part of the operation is marked as no longer<br>
"OK".) If you do $b = 12.34, $b has a valid numeric value but not a valid<br>
string value. If you then print $b, $b will have valid numeric *and* string<br>
parts, etc. etc.<br>
<br>
> $ perl -MDevel::Peek -le '$a = "12.34"; print "Before:"; Dump($a); 0 + $a;<br>
print "After:"; Dump($a)'<br>
> Before:<br>
> SV = PV(0xe58b68) at 0xe80ca8<br>
> REFCNT = 1<br>
> FLAGS = (POK,pPOK)<br>
> PV = 0xe7ad00 "12.34"\0<br>
> CUR = 5<br>
> LEN = 8<br>
> After:<br>
> SV = PVNV(0xe5a0b0) at 0xe80ca8<br>
> REFCNT = 1<br>
> FLAGS = (NOK,POK,pIOK,pNOK,pPOK)<br>
> IV = 12<br>
> NV = 12.34<br>
> PV = 0xe7ad00 "12.34"\0<br>
> CUR = 5<br>
> LEN = 8<br>
<br>
> $ perl -MDevel::Peek -le '$b = 12.34; print "Before:"; Dump($b); "" . $b;<br>
print "After:"; Dump($b)'<br>
> Before:<br>
> SV = NV(0x15810d0) at 0x1559ca8<br>
> REFCNT = 1<br>
> FLAGS = (NOK,pNOK)<br>
> NV = 12.34<br>
> After:<br>
> SV = PVNV(0x15330b0) at 0x1559ca8<br>
> REFCNT = 1<br>
> FLAGS = (NOK,POK,pNOK,pPOK)<br>
> IV = 0<br>
> NV = 12.34<br>
> PV = 0x157c020 "12.34"\0<br>
> CUR = 5<br>
> LEN = 40<br>
<br>
JSON is presumably turning JSON numeric literals into numeric scalars (storing<br>
0 + $val), and likewise when it gets a value that has NOK or IOK but not POK,<br>
it outputs a numeric value without quotes.<br>
<font color="#888888"><br>
Andrew<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>I take the "Shhhh" out of IT - ydy<br>
</div>