[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Another || quickie




On Aug 19, 2005, at 12:57 PM, Kenneth Thompson wrote:
So if I understand this correctly:
 
This:
 
    if ($oWkS->{Cells}[$iR][0]) {
      if ($oWkS->{Cells}[$iR][0]->Value != "") {
        $myVar = ($oWkS->{Cells}[$iR][0]->Value)
      }
    }
 
Is the same as this:
 
    if (!$oWkS->{Cells}[$iR][0]) {}
    elsif {$oWkS->{Cells}[$iR][0]->Value == "") {}
    else {
       $myVar = ($oWkS->{Cells}[$iR][0]->Value);
    }

IMHO the 2nd is less readable.

Which is shortcut(ed?) as this? :
 
    My $t = (!$oWkS->{Cells}[$iR][0];
    $myVar = ((!$t) || ($t->Value != "") || $t->Value);

I think your unmatched ( and "My" will syntax error. Perhaps this?:

    my $t = $oWkS->{Cells}[$iR][0];
    $myVar = $t->Value if ($t && $t->Value);

?

j