in reply to Making a code shorter

Since you imported the standard CGI package, there is no need to create the OO cgi object:
$q = new CGI;
Removing all those $q->'s might cut it down a bit too.