Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Extracting array of hashes from data

by Zaxo (Archbishop)
on Jun 10, 2001 at 01:27 UTC ( #87237=note: print w/replies, xml ) Need Help??


in reply to Extracting array of hashes from data

You use a good technique for setting $alldata{'EXPRESS'}, splitting on a field delimiter inside array ref brackets:

$alldata{$key} = [split /;/, $value]

You can place a SEQUENCE or PROTSYM element in a hash reference the same way:

# replaces everything in the last elsif(){...} push @{$alldata{$key}}, {split /;|=/, $value};

This works because a list with an even number of elements can always be treated as a hash. If you want to trim whitespace or something, that can be map'ped inside the braces.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Extracting array of hashes from data
by nysus (Curate) on Jun 10, 2001 at 19:35 UTC
    Very cool.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar";
    $nysus = $PM . $MCF;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87237]
help
Chatterbox?
[Corion]: Whee! Germanys Grand Central Airport (for Berlin, re-scheduled for the thrid or fourth time, to open now in 2018) has just fired their technical lead
[ambrus]: Corion: Is their budget estimate four times the initial estimate yet? Was the construction late by six months already three months after they started?
[marto]: I'll believe it when I see it. That's been due for many years now :P

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2017-02-23 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (345 votes). Check out past polls.