# XXX Unable to handle paths starting with a space or a # file named "-". The workaround is to prepend "./". my $file = @ARGV ? shift(@ARGV) : '-'; open(my $fh, "> $file") or die("Unable to open output file \"$file\": $!\n"); print $fh "this is a test\n";