Perl download file error

Hi all,

I have two pages. first page have download link, and second page have downlaod code. I had written this code to download the same file as .CSV where the download code written.

When i execute it , I am getting Scripting error. Someone plz help.

#!/usr/bin/perl
use CGI qw(:standard);
my $cgi = new CGI;
my $count = 0;
use CGI::Carp qw(fatalsToBrowser);

$html=$cgi->param('htmltable');

my @value1 = split('@', $html);

foreach my $val (@value1) {
    print "$val\
";
  }

print $cgi->header(-expires=>'now', -type=>'application/x-csv', -content_disposition=>"attachment; filename=export_teble.csv");
print "$html";
print $cgi->end_html;

Which error are you getting?