Are you sure it's not working as-written? That is, the line you're adding probably *is* being added to the end of that line - right after the carriage return. Which may be 10k characters later (the end of the file). While that "dos" error message may be related, it should be easy enough to ignore it.

I'd try this:

for (@testarray) { if (s[(<tr><th>PC Number</th><th>Cores</th><th>Date</th><th>Customer +</th><th>Target</th><th>C/O Time</th><th>Update time</th><th>Build Ti +me</th><th>Status</th><th>Changes from Last Build</th></tr>)][$1$line +]) { last; # found it, done. } }
Well, I might find yet other ways to clean that up.

Actually, I'd probably use XML::Twig (if the HTML were actually well-formed XHTML) or some other HTML parser to find the location and then insert my extra text in that way.


In reply to Re: Tie::file and html vs dos by Tanktalus
in thread Tie::file and html vs dos by Flubb

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.