in reply to Re: Re: Global symbol requires explicit package name
in thread Global symbol requires explicit package name

insert a line just above the "for" loop:
my %in;
...this declares a hash variable named "in". lookup perlvar section of perl documentation to learn about the basic variable types in perl.
keep using strict, especially that you're newbie. it will make you always declare variables. so if you mis-spell a variable name when accessing it, perl won't create it for you automatically as it does without "use strict".
  • Comment on Re: Re: Re: Global symbol requires explicit package name

Replies are listed 'Best First'.
Re: Re: Re: Re: Global symbol requires explicit package name
by Nickd_69 (Novice) on Aug 15, 2003 at 01:49 UTC
    Added the line of code you suggested and am now getting my favortie error premature end of script headers. Could you send me in the right direction to fix this problem which I always seem to get back to. Am reading some of the things you suggested now but they are fairly comprehensive and i don't really have time at the moment. Thanks for actually haveing some patience with me. Here is code so far:
    #!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use Mail::Mailer; my @param = qw( Title Name Position School Address Suburb State PCode Email Tel Fax Comments ); my $mailer = Mail::Mailer->new; $mailer->open({ To => 'foo@bar.com', From => 'baz@qux.com', Subject => 'results of submit', }); my %in; my $body; $body .= "$in{$_}\n" for @param; print $mailer $body; $mailer->close;
      Since this is a CGI process responding to a submitted form from a web browser, I believe the browswer is expecting to get some HTML data back, and it would get this when your script prints some amount of text to its STDOUT that qualifies as a valid HTML "page". But you are not printing anything out to STDOUT, so nothing is being returned to the browser.

      Look at the man page for the CGI module, for a simple example of how to output a minimal HTML "page" to keep the browser happy.