[Omaha.pm] Another || quickie
Jay Hannah
jay at jays.net
Thu Aug 18 15:00:51 PDT 2005
On Aug 18, 2005, at 4:55 PM, Andy Lester wrote:
> 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. :-/
Ya, 0 catches me on occasion. In this case, though, BEFORE and AFTER
would both handle 0 the same way, correct?
> Future Perls introduce the // operator, which does what you mean.
Oooo... Is there a :-/ operator too? That looks fancy. -grin-
j
:)
More information about the Omaha-pm
mailing list