Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How to read CPAN documentation

by scorpio17 (Monsignor)
on Jul 06, 2012 at 13:15 UTC ( #980259=note: print w/ replies, xml ) Need Help??


in reply to How to read CPAN documentation

Just use to_json() to go from perl to json, and from_json() to go from json to perl. Here's an example:

use strict; use JSON; use Data::Dumper; # Here's some data my $data = { A => 1, B => "hello world", D => [ [ 'dog', 'cat', 'bird', ], [ 'red','green','blue'], ], D => { X => 1, Y => 2, } }; # print the data print Dumper($data), "\n"; # convert perl data to json, then print out the json my $json = to_json($data); print "$json\n"; # convert the json back to perl, then print it. # should be the same as before my $data2 = from_json($json); print Dumper($data2), "\n";


Comment on Re: How to read CPAN documentation
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2015-07-07 03:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls