On Wed, Apr 29, 2009 at 09:11:43PM -0500, David Nicol wrote:
> Oh. We /DO/ have ternary allowed as an l-value:
> $ perl -wle '( $result_goes_there ? $there : $here ) = get_result(); sub
> get_result { 27} print "h:$here";print "t:$there"'
> indicates that $here was set to 27 and $there was undefined.
This feature is of course documented in perlop:
The operator may be assigned to if both the 2nd and 3rd arguments are
legal lvalues (meaning that you can assign to them):
($a_or_b ? $a : $b) = $c;
Ronald
Thread Previous
|
Thread Next