My guess is really going to be that it is your
select code,
just because this code is playing no obvious games that
would cause problems, and I know how
often I have made simple mistakes leading to my thinking
things like that. (I prefer to admit to the number of
times that I have seen others make that kind of mistake..)
Try this pattern:
my $file = "output.txt";
open (FOO, "> $file") or die "Cannot write '$file': $!";
select(FOO);
# Do stuff here during which default prints go to the file.
# BUT: print STDOUT $string; will still go to STDOUT. It
# isn't gone, just ignored by default.
select(STDOUT);
# If you are going to do a bunch more stuff.
close (FOO);
# prints here are back to normal.
Another option. Run this and redirect on the command line.
perl yourscript and args > outputfile
Oh, and long-term I strongly recommend moving to
Template::Toolkit. But that is another issue.
UPDATE
Another thought just struck me. If the above module is
being called in a script you are running with the system
command, then it will go to STDOUT even though you have
another thing selected. That probably isn't your situation,
but just in case...
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.