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


In reply to Re: Out of Memory after file open for append by pjf
in thread Out of Memory after file open for append by Anonymous Monk

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.