in reply to Ternary in void context

The ternary operator can be an lvalue. In that case I believe it is in void context. I don't know of any problem with using it in void context as a shorthand if..else construct, either, though I dislike to do that. ($var ? $yes : $no) = some_sub();

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Ternary in void context
by Anonymous Monk on Nov 29, 2003 at 23:48 UTC

    Lvalue context is not void context.

    $bar = 12; $bar; # void context; $bar = 13; # lvalue (not void) context $string = "foobar"; substr($string,0,3); # void context substr($string,0,3) = 're'; # lvalue (not void) context