Hi there,

I tried your code and add two print lines here to test it, and it looks fine to me!!!

And here the second print was appended to the first one.

my next Q is: How do you write to these files, can you give some example?

also you can see my version of your code here:

$tme=localtime(); my ($d,$m,$y) = (localtime)[3,4,5]; my $mdy1 = sprintf '%d-%d-%d', $d, $m+1, $y+1900; print "\nDate is:$mdy1\n"; if ($mdy1 eq "0-3-2015") {$mdy1 = "28-2-2015";} print "\nDate is:$mdy1\n"; $LOGFILE = "7252_Widevine_OemCrypto_Consolelog_User1"; $CONSOLE_LOGFILE = $LOGFILE.'_'.$mdy1.'.txt'; open CONSOLE_LOGF, ">", $CONSOLE_LOGFILE or die "Cannot open Console l +ogfile $CONSOLE_LOGFILE:$!"; system("pwd"); print CONSOLE_LOGF "[1st print]\n"; #<<<<<<<<<<<<<<< # Doing some operations here. close(CONSOLE_LOGF); $tme=localtime(); ($d,$m,$y) = (localtime)[3,4,5]; #my $mdy2 = sprintf '%d-%d-%d', $d-1, $m+1, $y+1900; my $mdy2 = sprintf '%d-%d-%d', $d, $m+1, $y+1900; print "\nDate is:$mdy2\n"; $LOGFILE1 = "7252_Widevine_OemCrypto_Consolelog_User1"; $CONSOLE_LOGFILE = $LOGFILE1.'_'.$mdy2.'.txt'; open(CONSOLE_LOGF, ">>", $CONSOLE_LOGFILE) || die "Cannot open Console + logfile $CONSOLE_LOGFILE: $!"; # ........... Here is where the previous contents are erased and new f +ile is created with new time(date is same here)..... system("pwd"); print CONSOLE_LOGF "[2nd print]\n"; #<<<<<<<<<<<<<<< # Doing some operations here. close(CONSOLE_LOGF);

In reply to Re: File append not working. Any help? by Hosen1989
in thread File append not working. Any help? by ramki067

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.