in reply to Binary output ot browser/force download?

You are almost there, before you print the array to need to tell it the content type of the file in question. If its a gif

print "Content-type: image/gif\n\n";

Or if its an application:

print "Content-type: application/octet-stream\n\n";

There are some others, you should just search around for them.

To force a download you can do a couple of things.
1. Before your content header you can do this:

print "Content-disposition: attachment\n";

However I understand that doesn't work in some versions of IE. So the second thing you can do is pass your filename as though it were part of the path. Anything after the cgi filename is considered path info and is recognized as a parameter, however the browser thinks its just a path and downloads it with the correct filename and everything. If you are using CGI you can set it up like this:

my $cgi = new CGI; my $filename = $cgi->path_info();

When you call that with a path like this:

http://your-domain.com/cgi-bin/script.cgi/your_file.doc
$filename will have "/your_file.doc" in it, you can remove the leading slash, print out the type and the rest of the file your browser will simply download "your_file.doc"

Hope that helps
Chris

Lobster Aliens Are attacking the world!