Hi, I've a file which is opened for writing and then i close it. Again i open the same file for appending to its contents, but its not appending, its removing the older contents and freshly starting. Any help on whats the issue?

How do you know its not appending? Where do you check to see if its appending in your code?

This won't go to the log  system("pwd");

Also,

Um, no

$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";

Um, yes

#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; use Time::Piece qw/ localtime /; use Data::Dump qw/ dd /; my $date = localtime()->strftime("%m-%d-%Y"); my $logprefix = "7252_Widevine_OemCrypto_Consolelog_User1"; my $logfile = $logprefix.'_'.$date.'.txt'; for my $ix ( 0 .. 3 ){ my $fh = path( $logfile )->opena_raw; print $fh "$ix\n"; close $fh; dd( path( $logfile )->slurp_raw ); } __END__ "0\n" "0\n1\n" "0\n1\n2\n" "0\n1\n2\n3\n"

In reply to Re: File append not working. Any help? by Anonymous Monk
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.