Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Extracting array of hashes from data

by Zaxo (Archbishop)
on Jun 10, 2001 at 01:27 UTC ( [id://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 (Parson) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://87237]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found