1 #!/usr/bin/perl -w 2 3 use strict; 4 #use diagnostics; 5 6 # Declare your variables here 7 8 my $logsum_file = "/exported/analysis/27Dec01.logsum"; 9 my $fw_logfile = "/exported/27Dec01.elog"; 10 11 my ($topten, @ips); 12 13 # Get the ten ip addresses from the daily fwlogsum report and 14 # store them in an anonymous array @ips 15 16 open REPORT, "$logsum_file" or die "Can't open logsum_file: $!\n"; 17 while (){ 18 chomp; 19 $topten = 1 if m!^Users\/Source Addresses!; 20 next unless $topten; 21 push @ips, [split /\s+/] if /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/; # create an array of arrays (perldoc perllol) 22 last if /^Users\/Destination Addresses/; 23 } 24 close REPORT, "$logsum_file" or die "Can't close $logsum_file: $!\n"; 25 26 #Separate ip addresses and number of attempts into separate arrays 27 28 my @newips; 29 my @attempts; 30 my ($x, $y); 31 for ($x = 0; $x < 15; $x++) { 32 push @newips, $ips[$x][0]; 33 push @attempts, $ips[$x][1]; 34 } 35 36 print "Here are the ips: @newips\n";