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

Re: [Omaha.pm] Another || quickie



Lol- which is what it ended up being, I just didn't include it since it was about && and not || ;)

-----Original Message-----
From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org] On Behalf Of Jay Hannah
Sent: Monday, August 22, 2005 9:55 PM
To: Perl Mongers of Omaha, Nebraska USA
Subject: 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

_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm