<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body ><div>Use 'exists' on hashes to check whether there is an entry for a key.</div><div><br></div><div>For example:</div><div><br></div><div>$Usage{$MAC}=0 if ( ! exists $Usage{$MAC} );</div><div><br></div><div>This should alleviate your warnings problem.</div><div><br></div><div><br></div><div><div style="font-size:9px;color:#575757">Sent from my Galaxy SĀ®III</div></div><br><br>-------- Original message --------<br>From: "Robert L. Harris" <robert.l.harris@gmail.com> <br>Date:02/14/2014  12:11 PM  (GMT-07:00) <br>To: boulder-pm <boulder-pm@pm.org> <br>Subject: [Boulder.pm] Adding undefined variables? <br><br><div dir="ltr"><div><br></div>Quicky here.  I'm processing logs do not necessarily know the MAC's of IP's I'm looking to find usage for.  Right now I'm doing this:<div><br></div><div><br></div><div><br>

</div><div>$Usage{$MAC}=0 if ( ! $Usage{$MAC} );</div><div>$Usage{$MAC}=$Usage{$MAC}+$NewUsage;</div><div><br></div><div><br></div><div>I could have swore there was a way to say something along the line of just set $Usage{$MAC} to Zero if it's not defined.  Without turning off warnings is my goal.</div>

<div><br></div><div><br></div><div>Anyone know a better or cleaner way to do this?</div><div><br></div><div>Robert</div><div><br></div><div><div><div><br></div>-- <br>:wq!<br>---------------------------------------------------------------------------<br>

Robert L. Harris<br><br>DISCLAIMER:<br>      These are MY OPINIONS             With Dreams To Be A King,<br>       ALONE.  I speak for                      First One Should Be A Man<br>       no-one else.                                     - Manowar
</div></div></div>
</body>