Fair enough ikegami.
I like using the !!$test construct to force a boolean to 1 or (''/0). However, if that isn't clear enough, I'd probably choose using the >0 test.
sort {$products{Cat}{Pro}{$b}{Qua}>0 <=> $products{Cat}{Pro}{$a}{Q +ua}>0 || $a <=> $b}
I suppose it still requires some level of understanding of the possible return values of conditionals, but that's one of the most important things to be familiar with when dealing with sorting in my opinion. Especially the <=> and cmp operators.
In reply to Re^3: Complex conditional sort
by wind
in thread Complex conditional sort
by Zhris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |