Your code indenting is very difficult to follow. Try to use indenting-whitespace to make code more legible. perlstyle is a good guide to start with.

As for your problem, my recommendation is to check the return values of your various print statements like this:

print OUT "$1\n" or die "Couldn't print to OUT at line __LINE__:\n$!\n";

You may be surprised to see:

Couldn't print to OUT at line 23: Bad file descriptor

With warnings turned on, are you seeing any warnings like...

print() on closed filehandle OUT at line 23.

I'm just making up 'line 23'... could be anything. The point is, I think you may be attempting to print to closed filehandles.

It's also possible that you're never satisfying the conditions of the if() block that actually prints to the files. Why not put in a little check with a print statement that prints "Printing to files...\n". That way at least you'll know whether or not you're entering the if block that does all the output.


Dave


In reply to Re: printing to filehandles by davido
in thread printing to filehandles by technofrog

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.