Help for this page

Select Code to Download


  1. or download this
    $totals = (
        $source => {
            $destination => $count,
        },
    );
    
  2. or download this
    my %totals;
    while (<LOGFILE>) {
        $totals{$1}->{$2}++ if m/(...)(...)(...)/;
    }
    
  3. or download this
    my $sth = $dbh->prepare('insert into totals (srcIP, dstIP, visit_count
    +) values (?, ?, ?)');
    foreach my $source (keys %totals) {
        $sth->execute($source, $_, $totals{$source}->{$_}) for keys %{ $to
    +tals{$source} };
    }
    
  4. or download this
      %ips = ( $src => "$dst");
      foreach $ws (keys(%ips)) {
        ...
      }