http://www.perlmonks.org?node_id=667871


in reply to appending data to a file

Here's the code as I've deciphered it:

open (writefile,">>",$target_full_path) || die "Can't open $target_ful +l_path"; while($fetchdata=$sth4->fetchrow_array()) { print $fetchdata; #it is working print writefile $fetchdata; # not appending $rowcount++; #here it is counting } close writefile; print $rowcount;

When you open, it doesn't die? Maybe try printing $target_full_path to make sure it has what you think it does. Your argument to die should include $! in it somewhere since that will have the error that caused open to fail.

I'm sorry, I don't see why this wouldn't work. What was the slight modification that causes it to break?