<?xml version="1.0" encoding="windows-1252"?>
<node id="453364" title="Re: please help to exclude my own IP address." created="2005-05-02 14:18:19" updated="2005-06-22 23:36:20">
<type id="11">
note</type>
<author id="107541">
fokat</author>
<data>
<field name="doctext">
&lt;p&gt;[cpan://NetAddr::IP] gives you a convenient way to do what you want.&lt;/p&gt;

&lt;p&gt;Say you know your &lt;em&gt;home&lt;/em&gt; IP address can be in the range 10.0.0.0 to 10.0.0.255 (or 10.0.0/24, in proper CIDR notation). Your code could then...&lt;/p&gt;

&lt;CODE&gt;
use NetAddr::IP;

my $home_net = new NetAddr::IP '10.0.0/24';
# ...
while (&lt;HANDLE_READING_YOUR_LOG&gt;)
{
  my ($string_ip, $rest) = split(/\s+/, $_, 2);
  my $ip = new NetAddr::IP $string_ip;
  next if $home_net-&gt;contains($ip);
  # Happily process $string_ip and $rest as it is not from your home net
  # ...
}
&lt;/code&gt;


&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-107541"&gt;
&lt;P&gt;Best regards&lt;/P&gt;

&lt;P&gt;-&lt;A HREF="http://mipagina.cantv.net/lem/"&gt;lem&lt;/A&gt;, but some call me fokat
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
453351</field>
<field name="parent_node">
453351</field>
</data>
</node>
