in reply to Forcing a Word Document to Download

I don't have a machine with Word on it handy to test, but I've had good luck with the following code to have the browser download the output of the CGI instead of just showing it.
#!/usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI->new; my $dir = '/path/to/file'; my $file = 'file.doc'; open(FILE, "$dir/$file") or die "Error opening file $file: $!"; print $cgi->header( -type => 'application/octet-stream', -attachment => $file, ); while(<FILE>) { print; } close(FILE);