use strict; use Spreadsheet::WriteExcel 0.31; use IO::Scalar; use CGI qw(:standard); print header('application/vnd.ms-excel'); my $xls_str; tie *XLS, 'IO::Scalar', \$xls_str; my $wb = Spreadsheet::WriteExcel->new(\*XLS); my $ws = $wb->addworksheet(); $ws->write(0, 0, "Hi Excel!"); $wb->close(); binmode(STDOUT); print $xls_str;