Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: appending data to a file

by graff (Chancellor)
on Feb 14, 2008 at 03:25 UTC ( #667873=note: print w/replies, xml ) Need Help??


in reply to appending data to a file

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://667873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2020-10-21 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (217 votes). Check out past polls.

    Notices?