http://www.perlmonks.org?node_id=98491


in reply to How do i return a file with CGI and suggest a file name to 'save as'

use CGI;

when printing the file to the browser, use the following header:

print $query->header(-type=>'application/octet-stream', -attachment=>'foo.doc');