- or download this
use strict;
use warnings;
...
my $eb = first { $_->{type} eq 'B' && $_->{time} >= $ea->{time} } @lis
+t;
printf "A %d B %d Diff %d\n", $ea->{time},$eb->{time},$eb->{time}-$ea-
+>{time};
- or download this
my ($i,$j);
while (1) {
...
splice @list,$j,1;
splice @list,$i,1;
}
- or download this
A 1000 B 1004 Diff 4
A 1002 B 1006 Diff 4
A 1008 B 1009 Diff 1