The files can be donloaded as follows
my $file_size=-s "report_generator/".$file;
print $q->header(
-type=>"text/csv",
-attachment=> "report_generator/$file",
-Content_Length=>"$file_size"
);
open (INFILE,"report_generator/".$file) or die("FAILED TO OPEN CSV FILE");
binmode(INFILE);
binmode(STDOUT);
while (){
print $_;
}
close(INFILE);
unlink ($file);
exit;