On Wed, Jan 14, 2009 at 4:32 PM, Dan Linder <span dir="ltr">&lt;<a href="mailto:dan@linder.org">dan@linder.org</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>Wow, did I stump all the Perl&nbsp;experts, or did everyone go on vacation? ;-)</div></blockquote><div><br>I&#39;m not an expert but I give it a go :)<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Another thought I had:&nbsp;Is it possible to &quot;define $hash{$key}&quot; manually without assigning a value to it?&nbsp; (i.e. the opposite of &quot;undef $hash{$key}&quot;)</div></blockquote><div><br>Yes but a warning will pop up in it&#39;s place &quot;Useless use of hash element in void context&quot;<br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div></div>
<font color="#888888">
<div>Dan<br></div></font><div><div></div><div class="Wj3C7c">
<div class="gmail_quote">On Tue, Jan 13, 2009 at 9:07 AM, Dan Linder <span dir="ltr">&lt;<a href="mailto:dan@linder.org" target="_blank">dan@linder.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>Jay Hannah <span dir="ltr">&lt;<a href="mailto:jay@jays.net" target="_blank">jay@jays.net</a>&gt;</span> wrote:<br>&gt; next if ($audit-&gt;{$date} &amp;&amp; $audit-&gt;{$date}-&gt;{$hotel} &amp;&amp; $audit-&gt;{$date}-&gt;{$hotel} &gt; 0);<br>

<br></div>
<div>Sterling Hanenkamp wrote:<br>&gt; I usually prefer:<br>&gt; next if ($audit-&gt;{$date}{$hotel} || 0) &gt; 0;<br><br></div>Ok, I&#39;m getting a similar issue with this bit of code:<br><span style="font-family: courier new,monospace;">55 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">56 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ($value, $parm)=split(/\s+/,$line,2);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">57 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $myhash1{$section_name}{$parm} = $value;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">58 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;"><br>Line 57 is spitting a lot of &quot;Use of unitialized value in hash element&quot; warnings -- I&#39;m pretty certain it&#39;s because of the newly defined %<span style="font-family: courier new,monospace;">myhash1</span> hash instantly having the $section_name and $parm keys used right away.</blockquote>
</div></div></div></blockquote><div><br>Make sure that each var in the hash key is defined. <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="Wj3C7c"><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"><br>I tried putting in these lines between 56 and 57:<br>
<span style="font-family: courier new,monospace;">55 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">56 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ($value, $parm)=split(/\s+/,$line,2);</span></blockquote>
</div></div></div></blockquote><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; $parm = &#39;&#39; unless ( defined $parm );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $section_name = &#39;&#39; unless ( defined $parm );<br style="font-family: courier new,monospace;">
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="Wj3C7c"><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">

<span style="font-family: courier new,monospace;">57 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ($myhash1{$section_name} || 0);</span><br style="font-family: courier new,monospace;" clear="all"><span style="font-family: courier new,monospace;">58 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ($</span><span style="font-family: courier new,monospace;">myhash1</span><span style="font-family: courier new,monospace;">{$section_name}{$parm} || 0);</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">59 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $</span><span style="font-family: courier new,monospace;">myhash1</span><span style="font-family: courier new,monospace;">{$section_name}{$parm} = $value;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">60 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</span><br>...but the warnings still persist.<br><br>Aside from turning off warnings for these lines, is there a better way to handle this?&nbsp; Should I be pre-loading the &quot;$myhash1{$section_name}&quot; branch first before adding the &quot;{$parm}&quot; branch to it?</blockquote>
</div></div></div></blockquote><div><br>&nbsp;That will take care of the warnings but it might hide a bug too :P<br><br></div></div><br>-- <br>Ted Katseres<br> &nbsp; &nbsp; &nbsp;||=O=||<br>