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


in reply to Append to file or create file depending on input filename.

In a similar vein to bellaire's reply, how about
open $filehandle, (@ARGV == 1 ? '>' : ()), @ARGV;
? This lets the user specify the mode on the command line just as you would in the program, using another argument.