Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Move data into AoH

by VinsWorldcom (Vicar)
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' } ];

Comment on Re: Move data into AoH
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2015-11-30 04:48 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 (757 votes), past polls