in reply to open file does not work for externally defined filename
What is the error message you get when opening your file?
open( FH, ">>$file") or die "Couldn't open '$file' for output: $!"; [download]
Also, what is the value of $file?