in reply to perl stdout and backtick execute

I'm more of a Windows guy, but that /var/www/cgi-bin looks like it's a directory used by a web server. If so, there may be different permissions for that directory and the STDOUT of the script when running from that directory might not be STDOUT of the shell (i.e. it's expecting to be run via web browser request through the web server, in which case STDOUT is HTTP response back to requesting client browser). Also, you might want to double-check the permissions for the script file after copying it to that directory.

That's my initial thoughts. But like I said, I'm more familiar with Windows, which means I could be wrong.