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

Re: how to extract data from an array using a condition

by xyzzy (Pilgrim)
on Jun 18, 2011 at 16:49 UTC ( [id://910338]=note: print w/replies, xml ) Need Help??


in reply to how to extract data from an array using a condition

if you want to use the names of the fields instead of the position, why not use an array of hash-references for each row? simply modify your code to split the header row into an array of keys, then read each row or data and map the values to the keys. if you do everything correctly, you would be able to extract what you want using something like

my @data = grep {$_->{bmi} > 40 && $_->bpi > 135 && $_->{sex} eq 'F'} @patients

$,=qq.\n.;print q.\/\/____\/.,q./\ \ / / \\.,q.    /_/__.,q..
Happy, sober, smart: pick two.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found