First, please see Short, Self-Contained, Correct Example - boiling down the code to the minimum needed to reproduce the problem both helps you narrow it down, and it helps us to have less irrelevant code to go through. Also, providing sample input with the expected output would be greatly helpful here.

Second, please see the Basic debugging checklist - I suspect items 3 and 4 may apply here. I would recommend Data::Dump or Data::Dumper with $Data::Dumper::Useqq=1;.

The reason is that I think this could be a line ending issue. I see you're not chomping your lines on input, which I would suggest you change, and if you do that you'll have to add a newline ("\n") when printing the lines back out. Corion already mentioned the possible Windows vs. Linux line endings issue.

There are quite a few other things about the code that could use an overhaul, such as bareword filenames and an unchecked open ("open" Best Practices), seemingly pointless flock calls, predeclaring variables when their scope could and should be limited, but at the moment it doesn't look to me like those are causing the issue.


In reply to Re: script runs, but doesn't appear to call file by haukex
in thread script runs, but doesn't appear to call file by schwende

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.