in reply to running a script from perl

You probably want to use system, not exec.

As you can read from perldoc perlfunc, exec never returns: the current process is replaced by the new one. This will cause your original guestbook CGI script to terminate abnormally without completing its task.

Another comment about file.sql: is it an actual executable (shell, perl, binary, whatever) or a file containing SQL statements only? In the latter case, you most probably need to run an SQL processor passing that file name.

-- TMTOWTDI