borisz has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I search for a better/shorter/more_readable way to set a var $x to exactly 0 or 1 depending on another var.
For example:
For example:
I rewrote this to:if ( $y ) { $x = 1; ... } else { $x = 0; }
if ( $x = !!$y || 0 ) { ... }
Boris
Back to
Seekers of Perl Wisdom