orangepeel1 has asked for the wisdom of the Perl Monks concerning the following question:

I couldn't find any documentation in the CGI module but I have data from a form that I'm processing with a perl cgi script. Is there any way to create a downloadable link to a file created from this data using perl cgi or do I need to strictly use html?

Replies are listed 'Best First'.
Re: Adding a download link with perl CGI
by Corion (Patriarch) on Mar 31, 2017 at 17:21 UTC

    I don't know what you mean by "strictly use html", but if you want to send a file for the user to download, you just send the appropriate headers and then the file content. The appropriate headers are Content-Type and Content-Disposition: attachment; filename="example.csv".

    With CGI, sending headers is basically:

    print $cgi->header( -type => 'text/csv', -Content_disposition => qq{attachment; filename="$target.csv"}, );