Firstly, yes it is possible to write to a local file. I tried your program and it worked creating
menu.txt.
If the file didn't get created then it is probably being created somewhere else. Put a
use Cwd;
print cwd();
Into your program to see where it thinks the current directory is, then look there for
menu.txt
Secondly - check the version of perl between your local machine and the remote machine.
perl -V
Will tell you, or if you don't have shell access just run that from a
system command.
If it is < perl 5.6 then use diagnostics won't work which is a possibly explanation.