in reply to Pimp my code - Schwartzian transform maybe?

Yes you can use the Schwartzian Transform. What you must do then, is preprocess the data so you no longer have to do those things in the comparison sub. I'm talking about stuff like int ($aIndex), $aIndex =~ s/\d*\.//, $aMode = ${$tagTypes{$aItem}}[2] and flagValue ($aMode). Each could be just a precaluted item in an anonymous array.

Preprocessing these expressions can be done with code like this:

map { my ($type, $item, $index) = @$_; my($fract) = $index =~ /\.(\d+)/; my $mode = ${$tagTypes{$item}}[2]; my $flagValue = flagValue($mode); [ $_, # original, 0 $type, # 1 int($index), # 2 $fract, # 3 $mode, # 4 $flagValue, # 5 ]; } @tagIndexes
The complete Schwartzian Transformed code then looks like this:
print join "\n", map {"$_->[0] $_->[1] $_->[2]"} map $_->[0], sort { $a->[2] <=> $b->[2] # int || $a->[3] <=> $b->[3] # fract || $a->[1] cmp $b->[1] # type || ( $a->[1] eq 'on' ? $a->[5] <=> $b->[5] # flagValue : $b->[5] <=> $a->[5] ); # off case } map { my ($type, $item, $index) = @$_; my($fract) = $index =~ /\.(\d+)/; my $mode = ${$tagTypes{$item}}[2]; my $flagValue = flagValue($mode); [ $_, $type, int($index), $fract, $mode, $flagValue ]; } @tagIndexes;

It appears to produce the same outcome for me.