Are You Wasting Time?

I wasted about 3 years when I first started on the internet.

The first website I built was on free web hosting. Never got more than 2 visitors a day and never made a penny.

Then I tried a web host that I didn't know anything about.
OOPS!
A BIG mistake and another waste of valuable time. My website was down half the time and when I tried to leave they stole my domain name.

I don't want you to make the same mistakes I made. That's why I only recommend top quality, dependable web hosting providers.

I recommend 3 in different price ranges:
Yahoo SB
$11.95 to $39.95

HostPapa
$5.95 to $7.95

CafW Hosting
$4.19 to $10.95

I recommend all 3 for quality and dependability.


CGI Scripts
to Create a Website with Interactive Features

Read a File and Display Contents

This script uses the file you saved in the previous exercise. Or you can copy the text file names_file.txt provided below to your cgi-bin directory and use it.

read_file.pl

This script will open the file names_file.txt, remove the field separator using the split function of Perl and display the contents to the screen.

#!/usr/bin/perl
open(INFO, "names_file.txt"); # Open db for reading and display
@array=<INFO>;
close (INFO);

print "Content-type:text/html\n\n"; #Content Header

print "<html>\n";
print "<head><title>Display File Contents</title></head>\n";
print "<body>\n";
print "<h4>This script displays the contents of names_file.txt.</h4>\n";

foreach $line (@array){
($last,$first)=split(/\|/,$line);
print "$first $last<br>\n";
}

print "</body>\n";
print "</html>\n";

Test this Script

names_file.txt

If you haven't completed the previous exercise, copy this file to notepad. Save it in the cgi-bin directory as names_file.txt.

Bunyan|Paul
Simpson|Bart
Anderson|Pamela
Bush|George

Note: If the scripts don't work:
1...Check the shebang line and make sure it is the path recommended by your web host to access the perl interpreter on your server.
2...Be sure to use the Chmod function on your ftp client or file manager to change the permissions of the script to 755