{ local $/ = ''; # empty string sets input_record_separator to "paragraph mode" # (blank line == end of input record) while () { # read a whole log record into $_ my ($addr,$name) = (/address: (\S+) \((.*)\)/); my %numbers; for my $io (qw/Incoming Outgoing/) { for my $fact (qw/packets bytes IP/) { ($numbers{$io}{$fact}) = (/$io total.*?(\d+) $fact/); } ($numbers{$io}{Rate}) = (/([\d.]+) kbytes.. $io/i); } # now move $addr, $name and contents of %numbers into the database } }