Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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
Replies are listed 'Best First'.
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 exploiting the Monastery: (14)
As of 2015-07-07 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls