[Omaha.pm] silly warnings

Dan Linder dan at linder.org
Tue Jan 13 07:07:04 PST 2009


Jay Hannah <jay at jays.net> wrote:
> next if ($audit->{$date} && $audit->{$date}->{$hotel} &&
$audit->{$date}->{$hotel} > 0);

Sterling Hanenkamp wrote:
> I usually prefer:
> next if ($audit->{$date}{$hotel} || 0) > 0;

Ok, I'm getting a similar issue with this bit of code:
55            } else {
56                ($value, $parm)=split(/\s+/,$line,2);
57                $myhash1{$section_name}{$parm} = $value;
58            }

Line 57 is spitting a lot of "Use of unitialized value in hash element"
warnings -- I'm pretty certain it's because of the newly defined
%myhash1hash instantly having the $section_name and $parm keys used
right away.

I tried putting in these lines between 56 and 57:
55            } else {
56                ($value, $parm)=split(/\s+/,$line,2);
57                ($myhash1{$section_name} || 0);
58                ($myhash1{$section_name}{$parm} || 0);
59                $myhash1{$section_name}{$parm} = $value;
60            }
...but the warnings still persist.

Aside from turning off warnings for these lines, is there a better way to
handle this?  Should I be pre-loading the "$myhash1{$section_name}" branch
first before adding the "{$parm}" branch to it?

Dan

-- 
"Quis custodiet ipsos custodes?" (Who can watch the watchmen?) -- from the
Satires of Juvenal
"I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author)
** *** ***** ******* *********** *************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20090113/3983d661/attachment.html>


More information about the Omaha-pm mailing list