I'm not sure I understand your problem. BUT as the other answer states you should fill in a correct header:
The script called from the webserver must be a CGI script. Which means that it should return the string:
"Content-type: text/html" (followed by two newlines)
So if you want to return HTML from your script it should look like this:
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
system("ls>mydir");
open(FIN, "mydir")
while () {
print $_;
}
close(FIN);
So in order to call something else than an ascii text (HTML), you should provide the HTTP server with a header identifying what you a sending back.
If you can provide me with more data I might be able to help you out. I don't fully understand whatyou mean by calling. You can call executables, but results will always be either binary or ascii.
I hope this helps you on your way, please remember to be carefull when using system calls on your CGI script, if somebody 'tweaks' your scripts theymight be able to do damage to your system.