Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Move data into AoH

by hdb (Prior)
on Sep 25, 2013 at 06:24 UTC ( #1055619=note: print w/ replies, xml ) Need Help??

in reply to Move data into AoH

JSON is a good starting point, but it requires field names and values in quotes. See the following code which does not work due to lack of quotes:

use strict; use warnings; use JSON; use Data::Dumper; my $json = <<EOT; [{field1:value1,field2:value2,field3:value3} ,{field1:value4,field2:value5,field3:value6} ,{field1:value7,field2:value8,field3:value9} ] EOT my $data = decode_json( $json ); print Dumper $data;

If you can't write a simple regex to fix the quote issue, I suggest to look into Text::CSV. With the help of that module you might be able to parse your text file. It really depends on how quotes, colons and commas interact in your file.

Comment on Re: Move data into AoH
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2015-11-29 07:26 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (748 votes), past polls