ttown1079 has asked for the wisdom of the Perl Monks concerning the following question:
---- #!/usr/bin/perl -w -Iperl use strict; + + $| = 1; + + my $globalCounter = 0; my %mon_log; + + my $month = "03"; my $year = "2004"; + + + + open(REPORTFILE, "inputfile") or die "$0: Can't open data file : $! +\n"; # open file + + open(DEBUGFILE, "> debug") or die "$0: Can't open debug file : $!\n +"; # open file + + while(<REPORTFILE>){ + + my($fmt_proto, $fmt_dest_ip, $fmt_src_ip, $fmt_dest_port, $fmt_src +_port, $fmt_drp_packets, $fmt_country) = split(/\s+/); + + print DEBUGFILE "{$month.$year}{$fmt_proto}{$fmt_dest_ip}{$fmt_des +t_port}{$fmt_src_ip}{$fmt_src_port}\n"; + + if(!exists($mon_log{$month.$year}{$fmt_proto}{$fmt_dest_ip}{$fmt_d +est_port}{$fmt_src_ip}{$fmt_src_port})){ $globalCounter += 1; print DEBUGFILE $globalCounter,"\n"; } + + $mon_log{$month.$year}{$fmt_proto}{$fmt_dest_ip}{$fmt_dest_port}{$ +fmt_src_ip}{$fmt_src_port} += $fmt_drp_packets; } + + close(REPORTFILE); close(DEBUGFILE); exit(0); --- input file format: icmp 123.45.67.89 123.76.243.210 0 11 + 1 United States icmp 142.156.23.54 12.254.215.10 0 11 + 1 United States
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: puzzling seg fault
by dragonchild (Archbishop) on Jun 30, 2004 at 19:00 UTC | |
|
Re: puzzling seg fault
by BrowserUk (Patriarch) on Jun 30, 2004 at 19:15 UTC | |
by ttown1079 (Initiate) on Jun 30, 2004 at 19:51 UTC | |
by BrowserUk (Patriarch) on Jun 30, 2004 at 20:40 UTC | |
|
Re: puzzling seg fault
by tachyon (Chancellor) on Jul 01, 2004 at 04:25 UTC | |
|
Re: puzzling seg fault
by samtregar (Abbot) on Jun 30, 2004 at 20:37 UTC | |
|
Re: puzzling seg fault
by Anonymous Monk on Jul 01, 2004 at 18:53 UTC | |
|
Re: puzzling seg fault
by ttown1079 (Initiate) on Jul 01, 2004 at 18:57 UTC |