Please show working code which does what you're trying to do. When I try the following, it doesn't work:
Q:\>perl -MCGI -le "foreach( keys CGI::Vars() ) { print }"
Type of arg 1 to keys must be hash (not subroutine entry) at -e line 1
+, near ") ) "
Execution of -e aborted due to compilation errors.
When I try the following, which the documentation and davidj suggest, it works (in the sense of not being a syntax error). But that works by returning a hash reference:
Q:\>perl -MCGI -le "foreach( keys %{ CGI::Vars() }) { print }"
Q:\>