Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Here's a suggestion, just to make sure you are looking at the right evidence when you say that the append operation is not working on the file (I'm also fixing your indentation a bit, and improving the error checking/reporting):
my $original_size = -s $target_full_path; # how many bytes in the fil +e open( my $out, ">>", $target_full_path) # I like using lexical file + handles, and or die "Can't open $target_full_path: $!"; # reporting system erro +r messages while($fetchdata=$sth4->fetchrow_array()) { print $fetchdata; print $out $fetchdata or die "print to file failed: $!"; $rowcount++; } close $out or die "Unable to close output file: $!"; print $rowcount; my $current_size = -s $target_full_path; # how many bytes now printf( "File %s was %d bytes, is now %d bytes\n", $target_full_path, $original_size, $current_size );
Maybe the reports you get from that version will tell you what you need to know.

In reply to Re: appending data to a file by graff
in thread appending data to a file by sudeep

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (4)
    As of 2020-10-31 05:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favourite web site is:












      Results (286 votes). Check out past polls.

      Notices?