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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to