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

Re: [Omaha.pm] Another || quickie




On Aug 18, 2005, at 4:55 PM, Andy Lester wrote:
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. :-/

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
:)