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

Hi, i'm writing a perl script which grabs some data from a db and dumps the data into a file for user to download. the thing is, even though it's only a text file, i don't want the file to be displayed in the browser, but to be downloaded. anyway if you're familiar with php the equivalent would be something like this:
header('Content-type: text/plain; charset=utf-8'); header("Content-disposition: attachment; filename=$today.txt"); print $output;
thanks for your help!

Replies are listed 'Best First'.
Re: download from cgi script
by edoc (Chaplain) on Jan 31, 2005 at 04:24 UTC
    print "Content-type: text/plain; charset=utf-8\n"; print "Content-disposition: attachment; filename=$today.txt\n"; print "\n"; print $output;

    cheers,

    J

Re: download from cgi script
by BUU (Prior) on Jan 31, 2005 at 02:45 UTC
    print('Content-type: text/plain; charset=utf-8'); print("Content-disposition: attachment; filename=$today.txt"); print $output;