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

Re: [Omaha.pm] Another || quickie



On Thu, Aug 18, 2005 at 03:52:59PM -0500, Jay Hannah (jhannah@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@petdance.com => www.petdance.com => AIM:petdance