If called from ssi, compare your headers to a none ssi call of the script.
If called one script from another, you can usually set a variable to flag such as "$pcontent++" after you print content so that it doesn't get executed twice:
if (!$pcontent) { print "content type...."; $pcontent++};
You can also look at your server environ variables. There will be different fields set depending on the source of the call. You'll have to parse and compare between a browser call, and a call as an include from another script.
What tool/utility can I use to view the http headers as they are sent to a browser?
How should I view server environ variables, <!--#printenv -->?
Calling the script directly displays in all browsers OK: [site.com...]
Including the script into a static page displays in all browsers OK:
<!--#include virtual="/cgi-bin/readcsv.pl?ModelKey==675" -->
Executing the script at the command line prints the content-type headers:
perl readcsv.pl