All pastes #369823 Raw Edit

Something

public text v1 · immutable
#369823 ·published 2007-02-24 02:05 UTC
rendered paste body
use warnings;
open LOG, "rubik.log" or die "Cannot open logfile";
#open LOG, "versionhistory.txt" or die "Cannot open logfile";
my $file = "out";
my $num = "1";
my $fileout = $file . $num . ".txt";
open OUT, ">$fileout" or die "Cannot open output file";

my ($line, $count);
# for (my $i = 0; $i <= 1000; $i++) {
#   $line = <LOG>;
#   print OUT $line;
# }
while ($line = <LOG>) {
  #$line = <LOG>;
  print OUT $line;
  $count++;
  ChgOut() if $count >= 30000;
}
# for ($line = (<LOG>)) {
#   print OUT $line;
#   $count++;
#   last if $count >= 1000;
#}
close OUT;
close LOG;


sub ChgOut {
  $count = 0;
  $num++;
  $fileout = $file . $num . ".txt";
  close OUT;
  open OUT, ">$fileout" or die "Error opening next output file";
}