Usually it was that I had not properly closed the file I had been writing to, or that the write buffer had not, for whatever reason, entirely been emptied
Perl flushes buffers when closing a file and closes files when exiting, so this is almost certainly not the problem, especially since the OP says that the closing tag still gets written after the truncation.
the latter problem of which was alleviated by turning the print handle "hot": $| = 1;
This won't help not only due to what I said above, but also because $| refers to the currently selected filehandle, so STDOUT by default; it won't do anything for code like OP showed. Even though it won't help here, for completeness, $filehandle->autoflush(1) is one way of controlling it.
In reply to Re^2: When can the character length of a Perl Scalar become an issue?
by haukex
in thread When can the character length of a Perl Scalar become an issue?
by misterperl
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |