After walking away from this for a while, I think what's confusing me is that the app is creating an error somehow. I'm getting a "premature ending of headers" error which usually indicates the HTTP headers are not being sent. But in my program, it's the first thing done and when I execute it from the command line, it's all there:
When I go to mypage.com/cgi-bin/test, I get a 500 internal server error and the error log gives the "premature" error mentioned above.
Content-type: text/html; charset=utf-8
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>..........
So getting past this issue might be most of the battle.
EDIT: I forgot to add that the only htaccess file I changed was the one in cgi-bin and it says "Options ExecCGI"