Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Move data into AoH

by VinsWorldcom (Parson)
on Sep 24, 2013 at 21:05 UTC ( #1055544=note: print w/replies, xml ) Need Help??

in reply to Move data into AoH

How are you getting / generating the text file?

If the name / value pairs are separated by '=>' and the values are quoted, this can be done with something as simple as eval:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array = @{eval <DATA>}; print Dumper \@array; __DATA__ [{field1=>'value1',field2=>'value2',field3=>'value3'},{field1=>'value4 +',field2=>'value5',field3=>'value6'},{field1=>'value7',field2=>'value +8',field3=>'value9'}]

And the output:

VinsWorldcomC:\Users\VinsWorldcom\tmp> $VAR1 = [ { 'field1' => 'value1', 'field2' => 'value2', 'field3' => 'value3' }, { 'field1' => 'value4', 'field2' => 'value5', 'field3' => 'value6' }, { 'field1' => 'value7', 'field2' => 'value8', 'field3' => 'value9' } ];

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055544]
[shmem]: glasswalk3r: just because I'm a bit annoyed

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2017-03-25 22:13 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.