Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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


Comment on Re: Extracting array of hashes from data
Select or Download Code
Re: Re: Extracting array of hashes from data
by nysus (Deacon) 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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2014-08-28 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (263 votes), past polls