[Omaha.pm] silly warnings

Jay Hannah jay at jays.net
Wed Dec 17 04:41:52 PST 2008


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



More information about the Omaha-pm mailing list