note
tobyink
<blockquote>
<p><i>"My guess is that if MaxRow or MaxCol are undefined then they are set to equal MinRow or MinCol respectfully."</i></p>
</blockquote>
<p>Very close. But it's not if they're undefined. It's if they're false. Undefined things are false, but so is 0, and so is the empty string, and so can be objects which overload boolification.</p>
<p>The <c>//=</c> operator would do what you originally suggested. It specifically checks undefinedness, not falseness.</p>
<p>The <c>//=</c> operator was introduced in Perl 5.10, so people wanting to do defined-or-assign while supporting ancient versions of Perl are forced to choose between <c>||=</c> (which might not be quite what they want - maybe they need to differentiate between undef and 0) or a more longwinded:</p>
<code>
$sheet->{MaxRow} = $sheet->{MinRow} unless defined $sheet->{MaxRow};
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-757127">
<small><small>
<tt>perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
</tt></small></small>
</div></div>
1003882
1003882