--- Miko O'Sullivan <[EMAIL PROTECTED]> wrote:
> SUMMARY
> 
> C<$var ?= $x : $y> as a shortcut for C<$var = $var ? $x : $y>.
> 
> 
> DETAILS
> 
> We have ||=, +=, -=, etc.  These shortcuts (I'm sure there's some
> fancy
> linguistic term for them) save us a few keystrokes and clean up the
> code.
> 
> So, concerning C<? :>, I find myself doing this type of thing a lot:
> 
>     $var = $var ? 1 : 0;

The only time this doesn't change type (arguably a bad thing in its own
right) is when you're doing boolean ops. And for those, there exist
boolean operators.

> How 'bout a shortcut for that, something like this:
> 
>     $var ?= 1 : 0;

Isn't this the same as C<$var &&= 1;> ?

=Austin

Reply via email to