in reply to Basic script help

As you don't show any of your code, it's kinda hard to help you here. Either show the minimal code, and how it fails to work for you, or look in your webserver error logs to see the error message for yourself.

Replies are listed 'Best First'.
Re^2: Basic script help
by zealf (Novice) on Feb 20, 2010 at 09:01 UTC
    Thank you for looking into it though! Here is one I am trying to execute.
    #!/usr/bin/perl -wT push(@Inc,"/cgi-bin"); require("cgi-lib.pl"); &ReadParse(*input); #Determine the base price based on the system variable if($input{'system'}eq"486d66"){ #set 486 only variables $computer_name = "486DX2-66"; $price = 1099; $memory = 4; $video = "VLB"; } else{ #not a 486 must be a pentium system $computer_name = "Pentium"; $memory=8; $video="pcl"; $cache="256K Cache"; if ($input{'system'}eq"P100"){$price=1799;$ptype=100} elsif($input{'system'}eq"15inch"){$price;$ptype=75} elsif($input{'system'}eq"P60"){$price=1450;$ptype=60} } #add extra price for monitors over 14 inch $monitor=$input{'monitor'}; if ($input{'monitor'}eq"17inch"){$price+=650;} elsif($input{'monitor'}eq"15inch"){$price+=200;} #add multimedia system if(defined($input{'sound'})){ $price+=190; $multimedia="Multimedia System"; } #add 14.4 modem price if (defined($input{'modem'})){ $price+=69; $modem="14.4 modem"; } print&PrintHeader; print <<print_tag; <html> <head> <title>$computer_name Systems from Austin Computer Center North</title +> </head> <body> <h1 align=center>Austin Computer Center North<br>Austin Texas!</h1> <center> <img src="/accn.jpg: align=left> <table border=5> <th colspan=2 align=center> <h2> ${computer_name}$ptype for only /$$price </h2> <tr><td><ul> <li>$memory megs of RAM <li>$cache <li>Enhanced IDE In/Out Controller <li>$monitor NIL SVGA Monitor <li>1 Meg $video SVGA Video Card <li>$multimedia </ul> <td><ul> <li>1.44 Floppy Drive <li>500+ meg Hard Drive <li>Mouse <li>Windows 95 <li>$modem </ul> <tr> <td align=right colspan=2><h2>1 YEAR WARRANTY PARTS & LABOUR!</h2> <tr> </table> </center> </body> </html> print_tag
    And this time I remembered the extra lines at the end. Here is the cgi-lib.pl which I have in the same directory.
    #!/usr/bin/perl -wT # Perl Routines to Manipulate CGI input # cgi-lib@pobox.com # $Id: cgi-lib.pl,v 2.18 1999/02/23 08:16:43 brenner Exp $ # # Copyright (c) 1993-1999 Steven E. Brenner # Unpublished work. # Permission granted to use and modify this library so long as the # copyright above is maintained, modifications are documented, and # credit is given for any use of the library. # # Thanks are due to many people for reporting bugs and suggestions # For more information, see: # http://cgi-lib.stanford.edu/cgi-lib/ $cgi_lib'version = sprintf("%d.%02d", q$Revision: 2.18 $ =~ /(\d+)\.(\ +d+)/); # Parameters affecting cgi-lib behavior # User-configurable parameters affecting file upload. $cgi_lib'maxdata = 131072; # maximum bytes to accept via POST - +2^17 $cgi_lib'writefiles = 0; # directory to which to write files, +or # 0 if files should not be written $cgi_lib'filepre = "cgi-lib"; # Prefix of file names, in directory +above # Do not change the following parameters unless you have special reaso +ns $cgi_lib'bufsize = 8192; # default buffer size when reading multi +part $cgi_lib'maxbound = 100; # maximum boundary length to be encounte +rd $cgi_lib'headerout = 0; # indicates whether the header has been +printed # ReadParse # Reads in GET or POST data, converts it to unescaped text, and puts # key/value pairs in %in, using "\0" to separate multiple selections # Returns >0 if there was input, 0 if there was no input # undef indicates some failure. # Now that cgi scripts can be put in the normal file space, it is usef +ul # to combine both the form and the script in one place. If no paramet +ers # are given (i.e., ReadParse returns FALSE), then a form could be outp +ut. # If a reference to a hash is given, then the data will be stored in t +hat # hash, but the data from $in and @in will become inaccessable. # If a variable-glob (e.g., *cgi_input) is the first parameter to Read +Parse, # information is stored there, rather than in $in, @in, and %in. # Second, third, and fourth parameters fill associative arrays analago +us to # %in with data relevant to file uploads. # If no method is given, the script will process both command-line arg +uments # of the form: name=value and any text that is in $ENV{'QUERY_STRING'} # This is intended to aid debugging and may be changed in future relea +ses sub ReadParse { # Disable warnings as this code deliberately uses local and environm +ent # variables which are preset to undef (i.e., not explicitly initiali +zed) local ($perlwarn); $perlwarn = $^W; $^W = 0; local (*in) = shift if @_; # CGI input local (*incfn, # Client's filename (may not be provid +ed) *inct, # Client's content-type (may not be provid +ed) *insfn) = @_; # Server's filename (for spooled files) local ($len, $type, $meth, $errflag, $cmdflag, $got, $name); binmode(STDIN); # we need these for DOS-based systems binmode(STDOUT); # and they shouldn't hurt anything else binmode(STDERR); # Get several useful env variables $type = $ENV{'CONTENT_TYPE'}; $len = $ENV{'CONTENT_LENGTH'}; $meth = $ENV{'REQUEST_METHOD'}; if ($len > $cgi_lib'maxdata) { #' &CgiDie("cgi-lib.pl: Request to receive too much data: $len byte +s\n"); } if (!defined $meth || $meth eq '' || $meth eq 'GET' || $meth eq 'HEAD' || $type eq 'application/x-www-form-urlencoded') { local ($key, $val, $i); # Read in text if (!defined $meth || $meth eq '') { $in = $ENV{'QUERY_STRING'}; $cmdflag = 1; # also use command-line options } elsif($meth eq 'GET' || $meth eq 'HEAD') { $in = $ENV{'QUERY_STRING'}; } elsif ($meth eq 'POST') { if (($got = read(STDIN, $in, $len) != $len)) {$errflag="Short Read: wanted $len, got $got\n";}; } else { &CgiDie("cgi-lib.pl: Unknown request method: $meth\n"); } @in = split(/[&;]/,$in); push(@in, @ARGV) if $cmdflag; # add command-line parameters foreach $i (0 .. $#in) { # Convert plus to space $in[$i] =~ s/\+/ /g; # Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; # Associate key and value $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple +separator $in{$key} .= $val; } } elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) { # for efficiency, compile multipart code only if needed $errflag = !(eval <<'END_MULTIPART'); local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $ +blen); local ($bpos, $lpos, $left, $amt, $fn, $ser); local ($bufsize, $maxbound, $writefiles) = ($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles); # The following lines exist solely to eliminate spurious warning m +essages $buf = ''; ($boundary) = $type =~ /boundary="([^"]+)"/; #"; # find boundary ($boundary) = $type =~ /boundary=(\S+)/ unless $boundary; &CgiDie ("Boundary not provided: probably a bug in your server") unless $boundary; $boundary = "--" . $boundary; $blen = length ($boundary); if ($ENV{'REQUEST_METHOD'} ne 'POST') { &CgiDie("Invalid request method for multipart/form-data: $meth\ +n"); } if ($writefiles) { local($me); stat ($writefiles); $writefiles = "/tmp" unless -d _ && -w _; # ($me) = $0 =~ m#([^/]*)$#; $writefiles .= "/$cgi_lib'filepre"; } # read in the data and split into parts: # put headers in @in and data in %in # General algorithm: # There are two dividers: the border and the '\r\n\r\n' between # header and body. Iterate between searching for these # Retain a buffer of size(bufsize+maxbound); the latter part is # to ensure that dividers don't get lost by wrapping between two b +ufs # Look for a divider in the current batch. If not found, then # save all of bufsize, move the maxbound extra buffer to the front + of # the buffer, and read in a new bufsize bytes. If a divider is fo +und, # save everything up to the divider. Then empty the buffer of eve +rything # up to the end of the divider. Refill buffer to bufsize+maxbound # Note slightly odd organization. Code before BODY: really goes + with # code following HEAD:, but is put first to 'pre-fill' buffers. B +ODY: # is placed before HEAD: because we first need to discard any 'pre +face,' # which would be analagous to a body without a preceeding head. $left = $len; PART: # find each part of the multi-part while reading data while (1) { die $@ if $errflag; $amt = ($left > $bufsize+$maxbound-length($buf) ? $bufsize+$maxbound-length($buf): $left); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $a +mt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; $in{$name} .= "\0" if defined $in{$name}; $in{$name} .= $fn if $fn; $name=~/([-\w]+)/; # This allows $insfn{$name} to be untainted if (defined $1) { $insfn{$1} .= "\0" if defined $insfn{$1}; $insfn{$1} .= $fn if $fn; } BODY: while (($bpos = index($buf, $boundary)) == -1) { if ($left == 0 && $buf eq '') { foreach $value (values %insfn) { unlink(split("\0",$value)); } &CgiDie("cgi-lib.pl: reached end of input while seeking boundary + " . "of multipart. Format of CGI input is wrong.\n"); } die $@ if $errflag; if ($name) { # if no $name, then it's the prologue -- discard if ($fn) { print FILE substr($buf, 0, $bufsize); } else { $in{$name} .= substr($buf, 0, $bufsize); } } $buf = substr($buf, $bufsize); $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==leng +th($buf); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != +$amt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; } if (defined $name) { # if no $name, then it's the prologue -- d +iscard if ($fn) { print FILE substr($buf, 0, $bpos-2); } else { $in {$name} .= substr($buf, 0, $bpos-2); } # kill l +ast \r\n } close (FILE); last PART if substr($buf, $bpos + $blen, 2) eq "--"; substr($buf, 0, $bpos+$blen+2) = ''; $amt = ($left > $bufsize+$maxbound-length($buf) ? $bufsize+$maxbound-length($buf) : $left); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $a +mt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; undef $head; undef $fn; HEAD: while (($lpos = index($buf, "\r\n\r\n")) == -1) { if ($left == 0 && $buf eq '') { foreach $value (values %insfn) { unlink(split("\0",$value)); } &CgiDie("cgi-lib: reached end of input while seeking end of " . "headers. Format of CGI input is wrong.\n$buf"); } die $@ if $errflag; $head .= substr($buf, 0, $bufsize); $buf = substr($buf, $bufsize); $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==leng +th($buf); $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != +$amt); die "Short Read: wanted $amt, got $got\n" if $errflag; $left -= $amt; } $head .= substr($buf, 0, $lpos+2); push (@in, $head); @heads = split("\r\n", $head); ($cd) = grep (/^\s*Content-Disposition:/i, @heads); ($ct) = grep (/^\s*Content-Type:/i, @heads); ($name) = $cd =~ /\bname="([^"]+)"/i; #"; ($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name; ($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be + null-str ($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname +; $incfn{$name} .= (defined $in{$name} ? "\0" : "") . (defined $fname ? $fname : ""); ($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i; #"; ($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defin +ed $ctype; $inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype; if ($writefiles && defined $fname) { $ser++; $fn = $writefiles . ".$$.$ser"; open (FILE, ">$fn") || &CgiDie("Couldn't open $fn\n"); binmode (FILE); # write files accurately } substr($buf, 0, $lpos+4) = ''; undef $fname; undef $ctype; } 1; END_MULTIPART if ($errflag) { local ($errmsg, $value); $errmsg = $@ || $errflag; foreach $value (values %insfn) { unlink(split("\0",$value)); } &CgiDie($errmsg); } else { # everything's ok. } } else { &CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n" +); } # no-ops to avoid warnings $insfn = $insfn; $incfn = $incfn; $inct = $inct; $^W = $perlwarn; return ($errflag ? undef : scalar(@in)); } # PrintHeader # Returns the magic line which tells WWW that we're an HTML document sub PrintHeader { return "Content-type: text/html\n\n"; } # HtmlTop # Returns the <head> of a document and the beginning of the body # with the title and a body <h1> header as specified by the parameter sub HtmlTop { local ($title) = @_; return <<END_OF_TEXT; <html> <head> <title>$title</title> </head> <body> <h1>$title</h1> END_OF_TEXT } # HtmlBot # Returns the </body>, </html> codes for the bottom of every HTML page sub HtmlBot { return "</body>\n</html>\n"; } # SplitParam # Splits a multi-valued parameter into a list of the constituent param +eters sub SplitParam { local ($param) = @_; local (@params) = split ("\0", $param); return (wantarray ? @params : $params[0]); } # MethGet # Return true if this cgi call was using the GET request, false otherw +ise sub MethGet { return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq +"GET"); } # MethPost # Return true if this cgi call was using the POST request, false other +wise sub MethPost { return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq +"POST"); } # MyBaseUrl # Returns the base URL to the script (i.e., no extra path or query str +ing) sub MyBaseUrl { local ($ret, $perlwarn); $perlwarn = $^W; $^W = 0; $ret = 'http://' . $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') . $ENV{'SCRIPT_NAME'}; $^W = $perlwarn; return $ret; } # MyFullUrl # Returns the full URL to the script (i.e., with extra path or query s +tring) sub MyFullUrl { local ($ret, $perlwarn); $perlwarn = $^W; $^W = 0; $ret = 'http://' . $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') . $ENV{'SCRIPT_NAME'} . $ENV{'PATH_INFO'} . (length ($ENV{'QUERY_STRING'}) ? "?$ENV{'QUERY_STRING'}" : '' +); $^W = $perlwarn; return $ret; } # MyURL # Returns the base URL to the script (i.e., no extra path or query str +ing) # This is obsolete and will be removed in later versions sub MyURL { return &MyBaseUrl; } # CgiError # Prints out an error message which which containes appropriate header +s, # markup, etcetera. # Parameters: # If no parameters, gives a generic error message # Otherwise, the first parameter will be the title and the rest will # be given as different paragraphs of the body sub CgiError { local (@msg) = @_; local ($i,$name); if (!@msg) { $name = &MyFullUrl; @msg = ("Error: script $name encountered fatal error\n"); }; if (!$cgi_lib'headerout) { #') print &PrintHeader; print "<html>\n<head>\n<title>$msg[0]</title>\n</head>\n<body>\n"; } print "<h1>$msg[0]</h1>\n"; foreach $i (1 .. $#msg) { print "<p>$msg[$i]</p>\n"; } $cgi_lib'headerout++; } # CgiDie # Identical to CgiError, but also quits with the passed error message. sub CgiDie { local (@msg) = @_; &CgiError (@msg); die @msg; } # PrintVariables # Nicely formats variables. Three calling options: # A non-null associative array - prints the items in that array # A type-glob - prints the items in the associated assoc array # nothing - defaults to use %in # Typical use: &PrintVariables() sub PrintVariables { local (*in) = @_ if @_ == 1; local (%in) = @_ if @_ > 1; local ($out, $key, $output); $output = "\n<dl compact>\n"; foreach $key (sort keys(%in)) { foreach (split("\0", $in{$key})) { ($out = $_) =~ s/\n/<br>\n/g; $output .= "<dt><b>$key</b>\n <dd>:<i>$out</i>:<br>\n"; } } $output .= "</dl>\n"; return $output; } # PrintEnv # Nicely formats all environment variables and returns HTML string sub PrintEnv { &PrintVariables(*ENV); } # The following lines exist only to avoid warning messages $cgi_lib'writefiles = $cgi_lib'writefiles; $cgi_lib'bufsize = $cgi_lib'bufsize ; $cgi_lib'maxbound = $cgi_lib'maxbound; $cgi_lib'version = $cgi_lib'version; $cgi_lib'filepre = $cgi_lib'filepre; 1; #return true
    Trying to execute the first code returns a 500error while on cpanel I'm not getting anything. regards, Gavyn
      push(@Inc,"/cgi-bin");

      I haven't looked at the rest of your code, but @Inc should definitely be @INC (Perl is case-sensitive).

      Also, note that the path you'd have to specify here is a physical path in the filesystem, not the logical path as shown in the URI — so /cgi-bin is likely incorrect, as it would denote a directory at the root of the filesystem.

        Hi there, I am finally making sense of what is going on. The tutorials I am working on have left out some vital informaiton, for example which file names to use and how each file works together. So far I have found a main html file executes a cgi file then executes another cgi file. When submitted of course. So here things go My main systems.html
        <html> <head> <title>My first computer Prog </title> </head> <body> <center> <form method="post" action="cgi-bin/fig56.cgi"> <table border=10> <th> <h3> Choose from one of <br>our standard configurations </h3> <tr> <td> Pentium 100 <input type="radio" name="system" value="P100" > Pentium 75 <input type="radio" name="system" value="P75" checked > Pentium 60 <input type="radio" name="system" value="P60" > 486 DX2 66 <input type="radio" name="system" value="486d66" > <tr> <td> 17 Inch Monitor <input type="radio" name="monitor" value="17inch" > 15 Inch Monitor <input type="radio" name="monitor" value="15inch" che +cked > 14 Inch Monitor <input type="radio" name="monitor" value="14inch" > <tr> <td> Multimedia? <input type="checkbox" name="sound" value="true" checked> Modem? <input type="checkbox" name="modem" value="true" checked> <tr> <td> <input type="submit" value="Get Current Price"> <input type="reset"> <tr> </table> </form> </center> <hr noshade> [ <A HREF="http://www.accn.com"> <img alt="Austin Computer Center " src="home.gif" border=1 A> | <A HREF="pindex.asp"> Parts Index </A> | </body> </html>
        Works perfectly, and correctly executes my fig56.cgi file as follows
        #!/usr/bin/perl -w push(@Inc,"home/themanin/www/cgi-bin"); require("cgi-lib.pl"); &ReadParse(*input); #Determine the base price based on the system variable if($input{'system'}eq"486d66"){ #set 486 only variables $computer_name = "486DX2-66"; $price = 1099; $memory = 4; $video = "VLB"; } else{ #not a 486 must be a pentium system $computer_name = "Pentium"; $memory=8; $video="pcl"; $cache="256K Cache"; if ($input{'system'}eq"P100"){$price=1799;$ptype=100} elsif($input{'system'}eq"P75"){$price=1550;$ptype=75} elsif($input{'system'}eq"P60"){$price=1450;$ptype=60} } #add extra price for monitors over 14 inch $monitor=$input{'monitor'}; if ($input{'monitor'}eq"17inch"){$price+=650;} elsif($input{'monitor'}eq"15inch"){$price+=200;} #add multimedia system if(defined($input{'sound'})){ $price+=190; $multimedia="Multimedia System"; } #add 14.4 modem price if (defined($input{'modem'})){ $price+=69; $modem="14.4 modem"; } print&PrintHeader; print <<print_tag; <html> <head> <title>$computer_name Systems from Gavyn Mickleson</title> </head> <body> <h1 align=center>Kingsville Computers<br>Melbourne!</h1> <center> <img src="../images/Logo_text.jpg": align="center"> <table border=5> <th colspan=2 align=center> <h2> ${computer_name}$ptype for only \$$price </h2> <tr><td><ul> <li>$memory megs of RAM <li>$cache <li>Enhanced IDE In/Out Controller <li>$monitor NIL SVGA Monitor <li>1 Meg $video SVGA Video Card <li>$multimedia </ul> <td><ul> <li>1.44 Floppy Drive <li>500+ meg Hard Drive <li>Mouse <li>Windows 95 <li>$modem </ul> <tr> <td align=right colspan=2><h2>1 YEAR WARRANTY If your Lucky!</h2> <tr> </table> <h3>Or Build your own</h3> <form method="post" action="List511.cgi"> <table> <th>CPU<th>Memory<th>Hard Disk<th>Video Card<th>Monitor <th>CD ROM <th>Modem <tr> <td> <select name="cpu"> <option value="P100">Pentium 100 <option value="P75">Pentium 75 <option value="P60">Pentium 60 <option value="486d66">486 DX2 66 </select> <td> <select name="memory"> <option value="32 MEG">32 Meg Memory <option value="16 MEG">16 Meg Memory <option value="8 MEG">8 Meg Memory <option value="4 MEG"> 4 Meg Memory </select> <td> <select name="disk"> <option value="1 GIG IDE">1 GIG IDE <option value="850 IDE">850 Meg IDE <option value="560 IDE">560 Meg IDE </select> <td> <select name="video"> <option value="4 MEG">4 Meg card <option value="2 MEG">2 Meg card <option value="1 MEG">1 Meg card </select> <td> <select name="monitor"> <option value="17 INch">17 .28 NI <option value="15 INch"> 15 .28 NI <option value="14 INch"> 14 .28 NI </select> <td> <select name="CD-ROM"> <option value="4X CDROM">Quad Speed <option value="2X CDROM">Double Speed <option value="NONE">NONE </select> <td> <select name="modem"> <option value="28.8 MODEM"> 28.8 <option value="14.4 MODEM">14.4 <option value="NONE">NONE </select> <tr> </table> <input type="submit" value="Get Current Price"> <input type="reset" </form> </center> </body> </html> print_tag
        I have found fig.56 to execute with both @INC and @Inc and mapping the directory I have corrected too. My first problem was a -T flag on the path to perl. Aparently used to enable a special user input Taint check. (soon to learn) Now in my fig.56 the html output allows a user to select parts from a drop down menu to build a machine, which in effect executes a List511.cgi file. (as follows) This one currently has me stuck. Any ideas?
        #!/usr/bin/perl -w push(@Inc,"home/themanin/www/cgi-bin"); require("cgi-lib.pl"); &ReadParse(*input); open($PRICE_FILE,"sys2.txt"); while(<$PRICE_FILE>){ chop; ($item,$price)=split(/:/,$_,2); $price_list{$item}=$price; } #Determine the base price based on the system variable $price=$price_list{$input{'cpu'}}; if ($input{'cpu'}eq"486d66"){ #set 486 only variables $computer_name="486DX2-66"; $video="VLB"; $price+=$price_list{$input{'memory'}}; $memory=$input{'memory'}; } else{ #not a 486 must be a pentium system $computer_name="Pentium"; $video="pcl"; $cache="256K Cache"; if($input{'memory'}ne"8 MEG"){ $price+=$price_list{$input{'memory'}}; } if ($input{'memory'}eq"4 MEG"){ $memory="8 MEG"; } else{$memory=$input{'memory'};} if($input{'cpu'}eq"P100"){$ptype=100} elseif($input{'cpu'}eq"P75"){$ptype=75} elseif($input{'cpu'}eq"P60"){$ptype=60} } #add extra price for monitors over 14inch $monitor=$input{'monitor'}; $price+=$price_list{$input{'monitor'}}; #add multimedia system if($input{'CD-ROM'}ne"NONE"{ $price+=$price_list{$input{'CD-ROM'}}; if($input{'CD-ROM'}eq"2X CD-ROM"){ $multimedia="Double Speed Multimedia System"; } else{ $multimedia="Quad Speed Mulitmedia System"; } } #add 14.4 modem price if ($input{'modem'}ne"NONE"){ $price+=$price_list{$input{'modem'}}; $modem=$input{'modem'}; } #add disk price $price+=$price_list{$input{'disk'}}; $DISK=$input{'disk'}; #add video $price+=$price_list{$input{'video'}}; $VIDEO=$input{'video'}; print&PrintHeader; #print<$in1>; print<<"print_tag"; <html> <head> <title>$computer_name Systems from your own Gavyn Mickleson</title> </head> <body> <h1 align=center>Kingsville Melbourne<br> Australia</h1> <center> <img src=" " align=left> <table boarder=5> <th colspan=2 align=center><h2> ${computer_name}$ptype for only /$$price </h2> <tr><td><ul> <li>$memory of Ram <li>$cache <li>Enhanced IDE In/Out Controller <li>$monitor NIL SVGA Monitor <li>$VIDEO $video SVGA Video Card <li>$mulitmedia </ul> <td><ul> <li>14.4 Floppy Drive <li>$DISK Hard Drive <li>Mouse <li>Windows 95 <li>$modem </ul> <tr> <td align=right colspan=2><h2>1 year selected warranty<italic>Only if +you worth if</italic></h2> <tr> </table> </center> </body> </html> print_tag
        Of course the sys2.txt is in the same directory as follows
        P100:1799 P75:1500 P60:1450 486d66:1099 32 MEG:800 16 MEG:300 8 MEG:16 +0 4 MEG:0 1 GIG IDE:175 850 IDE:110 560 IDE:0 4 MEG:320 2 MEG:120 1 M +EG:0 17 INch:650 15 INch:200 14 INch:0 4X CDROM:290 2X CDROM:190 NONE +:0 28.8 MODEM:139 14.4 MODEM:69 NONE:0
        BTW I did hand all type these. Gavyn
        Hi guys, thanks for all the input. I did manage to fix this script. Errors were in spelling. I now know the importance on a command line debug prior to uploading. Time to learn Enviroment variables. ;o)