$y ||= 10;
FWIW, be careful with that. Using ||= is one of my favorite ways to write fluent Perl, but it just got me burned a few days ago.
The problem was that the $y I was initializing was a numeric value - but zero was an acceptable value.
In that case, my ||= was overriding the supplied value of zero, which tested false against the operator. In the example here, providing an argument of 0 for $y will result in $y getting 10, not zero.
Oops. :-)
Peace,
-McD
In reply to Careful...
by McD
in thread sub ($self,$var,@arr) {}
by raptor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |