in reply to Re: Re: Re: Summarizing an array of IP's
in thread Summarizing an array of IP's
$ perl test syntax error at test line 15, near "+)" Execution of test aborted due to compilation errors.
use Socket; use strict; use warnings; my %stat; my @addr = qw(10.0.0.1 10.0.0.2 10.0.0.3 192.168.1.5 192.168.1.6 192.168.10.3 192.168.10.4 192.168.10.5); $stat{inet_ntoa(substr(inet_aton($_), 0, 3) . "\0")} ++ foreach (@addr ++); print "$_ has $stat{$_} nodes\n" foreach (keys %stat);
This is what I get. I copy and paste as is as my first test. I am using cygwin. I need to learn more about using Socket because I work a LOT with IP's and subnets. I need to sort IP's right now, so I'm working on that now. Thank you again.
Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_64_BIT_INT USE_LARGE_FILES PE +RL_IMPLICIT_CONTEXT Built under cygwin Compiled at Aug 29 2003 12:06:59 %ENV: CYGWIN="" @INC: /usr/lib/perl5/5.8.0/cygwin-multi-64int /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .
|
|---|