in reply to permission problems between commandline and CGI

As most has been already to varying degrees been pointed out accurately, I will comment on some subtle but essential details (forgive my offtopicness):

1.) Numerical comparisons are handled by the == comparator

Substitute

if ($connect eq 1) { }

with

if ($connect) { }

or (unnecessary)

if ($connect == 1) { }

2.) Use here docs

Instead of saying

print "<center>"; print "<H2> Error: Could not connect to server </H2>"; print "Please Try again later"; print "<HR></center>";

use

print <<'HTML'; <center> <H2> Error: Could not connect to server </H2> Please Try again later <HR></center> HTML

3.) use strict && use warnings

Always use strict. Always use warnings. Those will prevent a good amount of self-induced headache; latter should be omitted in ``production" code.