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

Re: [Omaha.pm] silly warnings



On Tue, Dec 16, 2008 at 5:25 PM, Jay Hannah <jhannah@omnihotels.com> wrote:
Laugh... Can I complain about too-noisy warnings forcing me to clutter my code again? Or am I already over quota?  -laugh-
 
Original code:
 
   use warnings;
   ...
   next if ($audit->{$date}->{$hotel} > 0);
Warning:
 
   Use of uninitialized value in numeric gt (>) at extract_launcher.pl line 192.
So now my code says this:
 
   next if ($audit->{$date} && $audit->{$date}->{$hotel} && $audit->{$date}->{$hotel} > 0);
Sigh...   :)

I usually prefer:

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

or:

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

Cheers,
Sterling

 
 
j
 
 

_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm