in reply to Logic for sorting of this given array

The logic for multiple sorting is as follows,

my @sorted = sort { $a->{'level'} <=> $b->{'level'} || $a->{'department'} cmp $b->{'department'} } @array;
That works by the lazy evaluation of logical operators. If comparison by level is not a tie, the department comparison is not made.

After Compline,
Zaxo