[Omaha.pm] Another || quickie

Andy Lester andy at petdance.com
Thu Aug 18 14:55:07 PDT 2005


On Thu, Aug 18, 2005 at 03:52:59PM -0500, Jay Hannah (jhannah at omnihotels.com) wrote:
> 
> BEFORE
> 
>   my $type = "error";
>   $type = $args{type} if ($args{type});
> 
> AFTER
> 
>   my $type = $args{type} || "error";

Which is fine unless $args{type} is 0. :-/

Future Perls introduce the // operator, which does what you mean.

-- 
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance


More information about the Omaha-pm mailing list