[tpm] Is there a three-way version of...
Shaun Fryer
sfryer at sourcery.ca
Sat May 30 11:30:37 PDT 2009
>> The "||", "//" and "&&" operators return the last value evaluated
>> (unlike C’s "||" and "&&", which return 0 or 1).
> $foo = $opt{foo} || $ENV{PROG_FOO} || $rc_opts{foo} || 'default';
This is interesting. I learned something new. Now I'm personally
curious if there's an operator that instead of doing "or equals", does
"equals or". For instance, I find myself doing this alot (particularly
in accessors/setters)...
$x = $y if defined $y;
What would be helpful is to be able to do this instead.
$x =|| $y;
Or even better...
$x =// $y;
Shaun Fryer
More information about the toronto-pm
mailing list