Couple things I see right away: looks like your first split should be on /\n\n/, and you are printing the return value of chomp($l1) where I think you want to first to do the chomp($l1) and then print $l1 (chomp doesn't return what you think).

Update: the chomp isn't even needed, since you've split on /\n/. Just replace chomp($l1) with $l1.

Update (more comments): you are using $4 and $8 without checking that the match succeeded. I'd at the very least say

if ($l2 =~ s/..../..../) { # $x and $y munging code # and substitution back into $l2 }
and preferably also add
else { warn "houston, we have a problem: $l2 "; }
I see from your use of \1,\2, etc. that you aren't using warnings; stick a use warnings; and use strict; at the top, declare your variables (with real names instead of l1, l2, etc.), and see what other problems turn up for you.

If $x or $y end up getting incremented, I think they may lose trailing zeros; if this is a problem, replace ++$x with $x = sprintf "%.2d", $x+1;; better yet, replace your whole substitution/rounding code with

s!(\d\d)\:(\d\d)\:(\d\d),(\d\d\d) --> (\d\d)\:(\d\d)\:(\d\d),(\d\d\d)! +sprintf("%s;%s;%s;%02.0f %s;%s;%s;%02.0f",$1,$2,$3,$4/10,$5,$6,$7,$8/ +10)!e
Update: even that has problems with 01:59:59,995 (which I'm guessing should become 02;00;00;00). Easiest way to avoid that is just add up total milliseconds and then divide it back out into hr,min,sec,centisecs.

In reply to Re: text reformatting woes by ysth
in thread text reformatting woes by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.