Randal L. Schwartz wrote: >>>>>>"Bryan" == Bryan R Harris <[EMAIL PROTECTED]> writes: > > Bryan> Is there an "&&=" also? How about "or="? > > There's an &&=, and I thought I'd never use it. > > However, one day, I realized that I needed to "normalize" the "true/false" > value of a variable, because I wanted to reduce all possible true/false > values to just 1/0 for easy operations in the next step of the program. > > And I came up with this: > > $variable ||= 0; # all false values become 0 > $variable &&= 1; # all true values become 1 > > OK, so it's weird. :) I could have just as easy had said: > > $variable = ($variable ? 1 : 0); > > But the actual case of needing &&= was cool.
Wouldn't $variable = !!$variable; work just as well? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>