For CGI programs you can also use the special Perl filename '-' which will redirect the output to STDOUT: my $workbook = Spreadsheet::WriteExcel->new('-'); See also, the cgi.pl program in the examples directory of the distro.