You are calling a function of a method.
First include that class in the program:
use CGI;
(if you get errors for that you need to download the CGI perlmodule)
Then create a variable "$query" of the CGI class:
my $query = new CGI;
That all you need to do. Try and dig up the documentation on the CGI permodule. Theres alot this thing cna do (like cookies).