-my @lines = readline or exit;
-chomp for @lines;
-my @values = map { s/^\h* ( -? [0-9]* (?:\.[0-9]+)? )//x and $1 } @lines;
-my @order = sort { $b <=> $a } grep { length } @values;
-if ($opt{trim}) {
- my $trimpos = abs $opt{trim};
- $trimpos == 1 ? ($_ = substr($_, 0, 1)) :
- (length > $trimpos and substr($_, $trimpos - 1) = '…') for @lines;
+if (defined $opt{follow}) {
+ $opt{follow} ||= 1;
+ $SIG{ALRM} = sub {
+ show_lines();
+ alarm $opt{follow};
+ };
+ alarm $opt{follow};
+}
+
+my (@lines, @values);
+while (readline) {
+ chomp;
+ push @values, s/^\h* ( -? [0-9]* (?:\.[0-9]+)? )//x && $1;
+ if (defined $opt{trim}) {
+ my $trimpos = abs $opt{trim};
+ if ($trimpos <= 1) {
+ $_ = substr $_, 0, 1;
+ }
+ elsif (length > $trimpos) {
+ substr($_, $trimpos - 1) = '…';
+ }
+ }
+ push @lines, $_;