in reply to Undeclared CGI???

Why don't you try starting with a very simple program:
#!/usr/bin/perl -w use strict; use CGI;

If that works, try adding in a line:

my $query = CGI->new();

If it still works, add in another line and whatever modules it requires, and so forth. That should help you narrow down exactly where the error is occuring.