use Spreadsheet::WriteExcel; use HTML::TableExtract qw(tree); require LWP::UserAgent; my $filename = "/home/user/report.xls"; # The excel generation using Spreasheet # The table extraction as element using TableExtract # All fine till now , and the excel is getting generated # with the desired content. # But this below piece of code is not working, please let me know how to make it work : open(FILE, "<$filename ") || die "Unable to download file \n"; my @fileholder; binmode FILE; @fileholder = ; close (FILE); print "Content-Type:application/vnd.ms-excel\n"; print "Content Disposition:attachment;filename=report.xls\n\n"; print @fileholder;