9 while (my $line = <>) {
11 if ($line =~ /^(\w+\/\d+):.*?(\d+) bytes incoming.*?(\d+) bytes outgoing/) {
12 $totals->{$1}->{'in'} = $2;
13 $totals->{$1}->{'out'} = $3;
17 foreach my $protocol (sort keys %$totals) {
18 my $p_in = $totals->{$protocol}->{in} / 1.0e6;
19 my $p_out = $totals->{$protocol}->{out} / 1.0e6;
20 $t_in += $totals->{$protocol}->{in};
21 $t_out += $totals->{$protocol}->{out};
22 print "$protocol $p_in $p_out\n";
25 printf "Total in %.1f MB Total out %.1f MB\n", $t_in/1.0e6, $t_out/1.0e6;