Re: perl flawed or my fault
- From: Eric Schwartz <emschwar@xxxxxxxxx>
- Date: 03 Oct 2006 13:47:32 -0600
anno4000@xxxxxxxxxxxxxxxxxxxxxx writes:
I am of a split mind about using ?: in lvalue context. It *is*
kind of obscure, but there are situations that simply call for
it. One is the loop of a binary search, for example
while ( $low < $high - 1 ) {
my $mid = ($low + $high)/2;
$list->[ $mid] le $targ ? $low : $high = $mid;
}
The if-else equivalent to ?: is four lines, even cuddling the else.
I can never bring myself to use it.
I don't object to that so much, but I'd still use the if-else
equivalent (and cuddle the else too! Bwahahahah!) just because I
think it's more readable.
-=Eric
.
- Follow-Ups:
- Re: perl flawed or my fault
- From: Tad McClellan
- Re: perl flawed or my fault
- References:
- perl flawed or my fault
- From: paul
- Re: perl flawed or my fault
- From: John W. Krahn
- Re: perl flawed or my fault
- From: Eric Schwartz
- Re: perl flawed or my fault
- From: anno4000
- perl flawed or my fault
- Prev by Date: Re: perl flawed or my fault
- Next by Date: Re: perl flawed or my fault
- Previous by thread: Re: perl flawed or my fault
- Next by thread: Re: perl flawed or my fault
- Index(es):
Relevant Pages
|