On 05/05/2012 03:27 AM, Linda W wrote:
> Linda W wrote:
>> Why should this yield an error:
>>
>> @_ ? #if (@_) {
>> ($M, $tM)=(shift, 100*$H+$M)
>> : #}else{
>> ($H, $M) = (int $H/100, $tM % 60);
>> #}
>> Assignment to both a list and a scalar at /tmp/pp.pl line 12, near ");"
>>
>> Where's the assignment to a scalar?
> ---
> Seems like this might also be a problem in 5.14... as it doesn't work
> there either.
>
> Is there some other interpretation that I'm missing?
>
a classic bug in your code. = binds tighter than ?:. the rule is never
to use ?: for side effects like =. it should be used for its result
expression only. you broke the rule.
uri
Thread Previous
|
Thread Next