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.