About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > Perl Basics...

   Browse by title articles:
   What is hot:

Perl/CGI Intro

CHMOD

Perl Basics

Scalar Data

Quotes

Uploading

Be the Master of Your Printer
HTML Basics
PreLoad
Transcendental function programming
 1 23456Next articles



Perl Basics


Computer & I'net articlesPerl Basics

by David Stanley    



Do you have your CHMOD set? If not, go back a page and do that first otherwise the rest of this will not work.

Creating a PERL file is the same as creating a text file. Open your text editor (such as Notepad) and save it with the extension of either .pl or some hosts require it to be .cgi to work. Either way, the coding is the same.

The first line of code (sometimes referred to the SHEBANG line) specifies the path to the PERL interpreter on the host. This path will vary from host to host, so be sure you get the right path from your host. Many hosts have a common one such as ...

#!/usr/bin/perl

NOTE : There is no semicolon at the end of this command line.

The next command line you need is something to tell the PERL that you are working with HTML (web pages). It sets the MIME type.

#!/usr/bin/perl
print "Content-type: text/html ";

After those two lines, you are into the PERL coding part of it. Two very important parts to remember are comments and semi-colons.

Comment lines let you document your coding. This makes it much easier for editing later on if you have a small paragraph telling what this part of the coding is doing or how. Basically, it is a "notes" type thing. Comment lines start with the # symbol. There is no semi-colon at the end of a comment line.

#!/usr/bin/perl
print "Content-type: text/html ";
# This is a comment. The program will not see this line.

Now, you may be wondering about the very first command line. It uses the same symbol, so in theory it would comment the PERL path out too. Well... don't worry about it. It won't comment out that one first line and it will find the PERL path. That first command line is "special".

The semi-colon ; is also a very important part of PERL. It states where each command ends. There are a few instances where it will not appear (such as the shebang and comment lines) but for the most part, they will appear at the end of each command line.

OK... Now you are ready go venture forth into the programming world of PERL!

BBBBBZZZZZZZ!!!!!!!
WRONG!

I would highly suggest going through each of the tutorial pages and learning the ins and outs of programming PERL. It is a great tool to use and if you've already learned JavaScript, most of this will be easy. So trudge on and learn it all :)




-----------------

Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.






Articles

Auto & Trucks

Business

Computer & I'net

  ·General

  ·Apache

  ·CSS

  ·Database

  ·Hardware

  ·HTML

  ·Javascript&DHTML

  ·Linux

  ·MySQL

  ·Operating System

Perl / CGI

  ·PHP

  ·Programming

  ·Publishing

  ·Search Engines

  ·Software Problems

  ·SSI

  ·Tips & Tricks

  ·Utilities

  ·Web Design

Family

Food & Drink

Gardening

Health

Other

Pets

Psychology

Spiritual

Travel

Women

 Calculators

Lease




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com