Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^5: How to add columns with new row name using perl from mysql query?

by poj (Abbot)
on Apr 05, 2017 at 17:02 UTC ( [id://1187160]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How to add columns with new row name using perl from mysql query?
in thread How to add columns with new row name using perl from mysql query?

To format the data for javascript use the JSON module

#!perl use strict; use warnings; use JSON 'encode_json'; my @top = ( ["adice_short", 254, 192], ["ncsim_short", 0, 84], ["ncsim_long", 41, 78], ["adice_long", 5, 39], ["normal", 170, 30], ["other", 1, 34], ); my @pend=(); my @run =(); for (@top){ push @pend,["$_->[0] ($_->[1])",$_->[1]]; push @run, ["$_->[0] ($_->[2])",$_->[2]]; } my $json_data_pend = encode_json( \@pend ); my $json_data_run = encode_json( \@run ); print "var data_run = $json_data_run \n";
poj

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1187160]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-28 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found