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

Re: [Omaha.pm] silly warnings



On Dec 16, 2008, at 8:41 PM, Sterling Hanenkamp wrote:
next if ($audit->{$date} && $audit->{$date}->{$hotel} && $audit- >{$date}->{$hotel} > 0);


I usually prefer:

next if ($audit->{$date}{$hotel} || 0) > 0;

!! Huh. That's an interesting side-step of the warning! Much shorter than mine. I like it! Thanks for the tip! :)

(I'm still bitter that you need a || 0 trick, though. -grin-)

j


$ cat j.pl
use warnings;
my $audit = {};
my $date = "20081217";
my $hotel = "ATLCNN";
# $audit->{$date}->{$hotel} = 7;
for (1) {
   next if (($audit->{$date}->{$hotel} || 0) > 0);
   print "no\n";
}

$ perl j.pl
no