1 00:00:38,585 --> 00:00:40,519 What's wrong? 2 00:00:40,554 --> 00:00:43,148 I think I hit something. #### #1 00;00;38;59 00;00;40;52 What's wrong? #2 00;00;40;55 00;00;43;15 I think I hit something. #3 00;00;43;92 00;00;45;41 You think it's a rock? #### open(IN,"./$file"); @infile = ; close(IN); open(OUT,">$file-FORMATTED.txt"); @sections = split(/\n/, @infile); foreach $i (@sections) { ($l1,$l2,@l3) = split(/\n/,$i); $output = "#",chomp($l1); $l2 =~ s/(\d\d)\:(\d\d)\:(\d\d),(\d\d\d) --> (\d\d)\:(\d\d)\:(\d\d),(\d\d\d)/\1;\2;\3;\4 \5;\6;\7;\8/; $x = $4; $y = $8; if(substr($x,2,1) > 5) { $x = substr($x,0,2); $x++; } else { $x = substr($x,0,2); } if(substr($y,2,1) > 5) { $y = substr($y,0,2); $y++; } else { $y = substr($y,0,2); } $l2 =~ s/(\d\d;\d\d;\d\d;)\d\d\d (\d\d;\d\d;\d\d;)\d\d\d/\1$x \2$y/; $output .= "$l2\n", join("\n",@l3), "\n"; print OUT $output; undef $l1; undef $l2; undef $x; undef $y; undef @l3; } close(OUT);