Languages

System

Application

Script

Database

HTML 4

DHTML

Technology

Client

Server

SB Tools

Protocols

SBuilder

 

Learning Perl CGI Syntax

Perl is an interpreted language that is optimized for string manipulation I/O (input-output stream) for the Unix system tasks.  This means that instead of compiling a program the computer interprets it during run time. As all script languages Perl which now become a programming language is an interpretive language, one of the qualities of forth generation language.

Here' simple syntax to begin with: Number sign # is comment
print("length: " ,length("hello world"));
# prints the same thing as
print "length: ",1, length "a";

Here's List program that list the text data:
$biggestInstrument = ("violin","viola","cello","bass")[3];
print("orchestral brass: ", join(" ",("trumpet","horn","trombone","euphonium","tuba")[0,1,2,4]), "\n");

Here's an example of an Array:
@stringInstruments = ("violin","viola","cello","bass");
@brass = ("trumpet","horn","trombone","euphonium","tuba");
$biggestInstrument = $stringInstruments[3];

print("orchestral brass: ", join(" ",@brass[0,1,2,4] ), "\n");

Here's an example of CGI form feed program:
<form action="/cgi-bin/mailform" method=GET>
<input name="to" type="hidden" value="johnsonb">
<b>To:</b> <code>johnsonb@ncsa.uiuc.edu</code>
<br>
<b>Subject:</b> <input name="subject" size=40>
<br>
<b>Comments:</b>
<br>
<textarea name="comments" ROWS=8 COLS=60></textarea>
<br><input type="submit" value="Send">
</form>

Here's an example of server side script:
##############################
# construct the headers
##############################
print(MAIL "To: recipient\n");
if ( ! $cgiVals{'subject'} ) {
    $cgiVals{'subject'} = "(no subject)";
}
print(MAIL "Subject: $cgiVals{subject}\n");
if ( ! $cgiVals{'from'} ) {
    $cgiVals{'from'} = "nobody";
}
print( MAIL "From: $cgiVals{from}\n");
# done with the headers.   Add the blank line.
print( MAIL "\n");
###########################
# construct the body
###########################
foreach $key ( keys(%cgiVals) ) {
    if ( $key eq "to" || $key eq "subject" || $key eq "from" ) {
next;
    } 
    print( MAIL "$key: $cgiVals{$key}\n");
}

###########################
# All done.  Clean up.
###########################
close(MAIL);
# the response.
print("Form submitted successfully.  Thanks!");
exit(0);

    Perl is not that hard to learn. But to write sophistecated program for ecommerce will need a lot of experience.  Background of Basic or Fortran will help a lot.

    Perl from the beginning use to program Unix due to the World Wide Web servers were running on the Unix environment.  As a matter of fact the World Wide Web started with the Unix. So if you are interested in Unix programming then Perl could be marketable.

    Topic CGI: Common Gateway Interface technology made the Internet able to do the ecommerce in the beginning. This technology is still very much used on the Internet.  It has some security issue that may be minner problem which can be fixed by proper designing of the interface.  As it has been mentioned that CGI can be writen any language. 

The Internet technology is highly intergratedmany different languages. All programming languages are evolved around the web.  Perl made the web interactive and CGI help to perform ecommerce. Java language transformed the technology and opened wide avenues of opportunity.  Visual Basic has brought revolution in term of site building for ecommerce.

Designed by
Prakash Bom