The initial
if block can be simplified to something like this
if(not defined $institution) {
$institution_table{ unaffiliated }++;
} else {
$institution_table{ $_ }++
for grep { $institution eq $_ } ( $hospital1 $hospital2 );
}
But I think that could be cleaned up more by using less singular variables. As for the
for loop you're trying to use
perl6 style number comparisons and the comparisons don't seem to match the age bracket. Maybe you mean something like this
$institution_table{$_}->{"fortyfive_fifty"} ++
if 45 > $age and $age <= 50;
And the
sort() is superfluous in the
for loop (well at least from the code provided). Probably the best way to simplify your is to simplify your data structures (as one follows the other).
</code>
HTH
_________
broquaint