Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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 ( #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
  • Comment on Re^5: How to add columns with new row name using perl from mysql query?
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2021-04-19 22:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?