in reply to Perl text file writing

As a side note, it looks like your append logic is backwards. I think you want
if ($append) { open(MYOUTFILE, ">>filename.out"); # open for append } else { open(MYOUTFILE, ">filename.out"); #open for (over)write }