Handle multiple commands typed at same second.

This commit is contained in:
Bradley M. Kuhn 2010-03-14 11:49:36 -04:00
parent 1b1011d439
commit 1f6d088c29

View file

@ -20,17 +20,19 @@ use strict;
use warnings;
my %history;
my $time;
while (my $line = <>) {
chomp $line;
if ($line =~ /^#\s*(\d+)/) {
my $key = $1;
my $cmd;
$cmd = <>;
chomp $cmd;
$history{$key} = $cmd;
$time = $1;
} else {
$history{$time} = {} if not defined $history{$time};
$history{$time}{$line} = 1;
}
}
foreach my $key (sort { $a cmp $b } keys %history) {
print "#$key\n$history{$key}\n";
foreach my $cmd (keys %{$history{$key}}) {
print "#$key\n$cmd\n";
}
}