in reply to Re: I almost got it!
in thread I almost got it!

When using CGI.pm, you may also replace:

#!/usr/bin/perl
print "Content-type: text/html\n\n";

With:

#!/usr/bin/perl -w

use strict;
use CGI qw(-no_debug :standard);
my $q = new CGI;

print $q->header; # prints default 
                  # content-type, 
                  # which is text/html

# rest of progam...

__END__

 Notes: qw(-no_debug :standard) is
 for disabling command line input
 and only importing the standard 
 functions in CGI.pm, instead of
 ALL of them -- which you probably
 don't need.

 $q is the same as $query in your 
 example. You can name that variable
 anything you wish. 

 $q is your new CGI object, -> means 
 your actually pointing to a function
 in CGI.pm. the text after the -> is
 the function you would like to use.

 i.e. $q->header;

      This is your new CGI object ($q),
      referencing the header() 
      function in the 'standard' set
      of functions that you imported 
      from CGI.pm.

 Finally, test your program, as you go,
 from the command line like so, to test 
 for errors:

 /path/to/perl -wc <program_name>

 (where <program_name> is the name of
 your script.)

 Cheers!