+ if (defined($row->{log_text}))
+ { # convert to a hash, find ranges, output list of ranges
+ my $h = { split /\s+/, $row->{log_text} };
+ my $i;
+ my $start;
+ my @ranges;
+
+ foreach my $k (sort {$a<=>$b} keys %$h)
+ {
+ if (defined $start)
+ {
+ if ($h->{$k} ne $h->{$start})
+ {
+ push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i);
+ $start = $k;
+ $i = 1;
+ }
+ else
+ {
+ $i++;
+ }
+ }
+ else
+ {
+ $start = $k;
+ $i = 1;
+ }
+ }
+ if (defined $start)
+ {
+ push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i);
+ }
+
+ $row->{log_text} = \@ranges;
+ }
+