> -----Original Message----- > From: Colby [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 19, 2001 3:25 PM > To: [EMAIL PROTECTED] > Subject: What is the source of the error (listed below, its lengthy) > > > When I run my index.pl script from the command line I get the > following > output: > > print (...) interpreted as function at ./index.pl line 10. This warning is caused by the space between "print" and the opening paren. You can suppress the warning by writing: print( qq| # note no space after print instead of print ( qq| Why the warning? Consider the following: print 1 + 2 * 3; # prints 7 print (1 + 2) * 3; # prints 3 (!) print 3 * (1 + 2); # prints 9 In the second example, the parens aren't doing grouping, but are being treated as the argument list to print. Normally, parens to enclose the argument list come without intervening whitespace, so the warning is issued in a case like #2 above to let you know that perl may not be doing what you mean to do. > Content-Type: text/html; charset=ISO-8859-1 > > Use of uninitialized value in concatenation (.) or string at > ./index.pl > line 10. > Use of uninitialized value in concatenation (.) or string at > ./index.pl > line 10. You are interpolating some variables that have an undef value. The line 10 refers just to the start of the string; the actual variables are down inside the qq|| block somewhere. Assuming you want these undef values to be interpolated as empty strings, you can suppress the warnings by removing -w and adding the following to the top of your script: use warnings; no warnings qw(uninitialized); (n.b. this only works in Perl 5.6 or higher). See perldoc perllexwarn for all the gory details. > > <HTML> > <HEAD> > .... The rest is all good and dandy > > Here's the code w/added line numbers for clarity: > > 1. #!/usr/bin/perl -wT > 2. > 3. use strict; > 4. use CGI; > 5. > 6. my $q = new CGI; > 7. > 8. print $q->header ( "text/html" ); > 9. > 10. print ( qq| > 11. <HTML> > 12. <HEAD> > .... blah blah blah > <!-- end of html --> | ); > print $q->end_html ; > > Am I missing a "use something::here"?? > The output to a browser doesn't include the warnings, just the wanted > HTML. This question is for the pragmatist in me more than to > correct an > error. The warnings go to STDERR, which is typically routed to your server error logs. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]