# remove extra spaces
my $fields = () = $summary =~ /[\s+,:]/g;
####
>perl -MYAPE::Regex::Explain -E 'say YAPE::Regex::Explain->new(q<[\s+,:]>)->explain'
The regular expression:
(?-imsx:[\s+,:])
matches as follows:
NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
[\s+,:] any character of: whitespace (\n, \r, \t,
\f, and " "), '+', ',', ':'
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
####
elsif ( $fields == 10 ) {
( $Star, $Intf, $IHQ, $IQD, $OHQ, $OQD, $RXBS, $RXPS, $TXBS, $TXPS, $TRTL )
= split( ' ', $summary );
####
my $Star = 0;
my $Intf = 0;
my $IHQ = 0;
my $IQD = 0;
my $OHQ = 0;
my $OQD = 0;
my $RXBS = 0;
my $RXPS = 0;
my $TXBS = 0;
my $TXPS = 0;
my $TRTL = 0;
my $Track = "";
# ...
} elsif ( $fields == 10 ) {
( $Star, $Intf, $IHQ, $IQD, $OHQ, $OQD, $RXBS, $RXPS, $TXBS, $TXPS, $TRTL )
= split( ' ', $summary );
# ...
$Track = join "<<-", $rec, $Intf;
$interface_bytes{$Track} += $RXBS;
$Track = join "->>", $rec, $Intf;
$interface_bytes{$Track} += $TXBS;
# ...
}
####
$Track = join "<<-", $rec, $Intf;
$interface_bytes{$Track} += $RXBS;
####
$interface_bytes{"$rec<<-$Intf"}+=$RXBS;
####
if ( $Star ne "*" ) { next; }
elsif ( $RXBS =~ /\D/ ) { next; }
elsif ( $TXBS =~ /\D/ ) { next; }
####
} else {
print STDERR
"Danger Will Robinson - my sensors detect an invisible hole that may consume you\n";
}