SPUG: generating output with a cgi script

Wu, Yaoxi yaoxi.wu at attws.com
Mon Oct 2 12:44:28 CDT 2000

This thing is driving me crazy; I hope someone can enlighten me. Please look
at the following short cgi script:

#!/usr/bin/perl -wT
use CGI;
$cgi = new CGI;
print $cgi->header("text/plain");
open(DB_FILE, "test.bib");
undef $/;
close DB_FILE;

#### the following was displayed o.k. ##########

print "Any string.\n";
print $cgi->param('source_type'),"\n";

#### the following did not show up in the web browser window ###

print "$line\n";
foreach $name ($cgi->param){
       print "$name:\n";
       foreach $value ($cgi-param($name)){
       print " $values\n";

This simple script tries to display the content of a two-line text file, "
test.bib", and the values of the parameters that the user input from a web
page. I don't know why the statement, print "$line\n", displayed nothing,
although when the script run off-line and was terminated with 'control-D',
the file content was displayed. Also, why the values of the user-supplied
parameters could not display in this "foreach" loop, but would display when
printing individually? Thanks for any help.


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/

More information about the spug-list mailing list