Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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,

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?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2016-10-29 00:24 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (387 votes). Check out past polls.