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.