note
anonymized user 468275
Looks like you need a sort function or block and to keep the previous (sorted) case in an up-scope variable, e.g.
<code>
my $prevCase = '';
for my $i (sort caseThenId (0..$#$var1) {
my $case = $var1->[$i]{case};
print "$case:"\n" if $case ne $prevCase;
$prevCase = $case;
print $var1->[$i]{id} . ") "
. $var1->[$i]{name} . ", "
. $var1->[$i]{degree} . "\n";
}
sub caseThenId {
$var1->[$a]{case} cmp $var1->[$b]{case}
or $var1->[$a]{id} cmp $var1->[$b]{id};
}
</code>
Update: $var1 should be a reference to your array in the above example.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-468275">
<p><i>One world, one people</i>
</div></div>
1137539
1137539