##
$htmlfile = $opt_outfile if defined $opt_outfile;
...
$htmlfile = "-" unless $htmlfile; # stdout
...
# open the output file
print STDERR ">$htmlfile";
open(HTML, ">$htmlfile")
|| die "$0: cannot open $htmlfile file for output: $!\n";