Having a bit more of your program (like the lines between that open and the strftime line) would probably help, as both the lines that you've listed are fine, and there are many things that could potentially chew up all your memory. Common things are slurping an entire very large file, infinite recursion, or building an incredibly big list with something like (1..1000000000).
On a completely different track, the '%D' format for strftime prints the date in MM/DD/YYYY format, which is great if you're in America, but terribly confusing in many other places in the world (such as Europe or Australia). It also uses a 2-digit year, and we all know how much trouble people got into for using that last century.
If you wish to have an unambiguous, internationally readable date, then "%Y-%m-%d" is highly recommended.
As a different aside, evaluating localtime() in a scalar context also returns an unambiguous, human readable date.
Cheers, Paul | [reply] |
To open your file for appending you'll need to use something like:
open(FILE,">>$write_file")
or die "file '$write_file' could not be opened for update: $!";
</code>
I added the filename to the error message along with '$!' which is the OS level error. It can be very helpful for
tracking down why your open failed.
See open for more details.
Update: lemming points out that $write_file might already contain the '>>', i.e. $write_file = '>>/my/filename' In that case, adding an extra '>>' would be superfluous and incorrect.... w/o more code, we can't tell one way or the other.
-Blake
| [reply] [d/l] [select] |