my $grenzwert = 35; my $data; while ( my $line = ) { my( $bytes ) = $line =~ /\s(\d+)$/; if ( $bytes > $grenzwert ) { $data .= '1' } else { $data .= '0' } } my @fail; for my $ausfall ( $data =~ /(0+)/g ) { push @fail, length $ausfall; } my $summe = 0; $summe += $_ for @fail; my $mittel = $summe / @fail; print "Ausfaelle: " . join( ", ", @fail ) . "\n"; print "$summe Sekunden insg. und "; print "$mittel Sekunden im Mittel pro Ausfall\n";