Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Move data into AoH

by VinsWorldcom (Priest)
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> test.pl $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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-12-23 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (134 votes), past polls