Am 24.03.2015 um 14:03 schrieb Shlomi Fish:
> This can be more idiomatically written as:
>
> $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2]
I agree, a
sort {
$a->[0] <=> $b->[0] or
$a->[1] <=> $b->[1] or
$a->[2] <=> $b->[2]
}
is certainly more readable than the C-style
sort {
$a->[0] <=> $b->[0] ? $a->[0] <=> $b->[0] :
$a->[1] <=> $b->[1] ? $a->[1] <=> $b->[1] :
$a->[2] <=> $b->[2] ? $a->[2] <=> $b->[2] :
$a->[3] <=> $b->[3]
}
Simon
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/