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


in reply to Print to Browser Headers Not Working

To tell the browser you want it to save the content as a file, you need the Content-Disposition header:

Content-Disposition: attachment; filename="example.csv"