Can someone please give a detailed tutorial on how to embed Perl in HTML? This means give specific instructions on what to download, where to download it, what files I need to download, and how I would somehow put that into my HTML file.
My code is:
# "E:\My Vaults\My Vault\Perl\happy.pl"
# Displays a warm greeting.
print "What is your name? ";
my $name = <STDIN>;
chomp($name);
print "Hello, $name! I am a computer! Austin is my author! He created
+this Perl quiz!\n";
# User greets the computer.
print "Please greet me so I know I am welcome.\n";
my $greet = <STDIN>;
# Displays difference between ages.
chomp($greet);
print "$greet to you, too. What year were you born in, $name? ";
my $dob = <STDIN>;
if (($dob eq '')) {
print "Hey! Why won't you answer?\n";
}
if (($dob < 1996)) {
my $difference = 1997 - $dob;
chomp($difference);
print "You are $difference years older than my author, Austin.\n";
}
if (($dob > 1998)) {
my $difference = $dob - 1997;
chomp($difference);
print "You are $difference years younger than my author, Austin.\n
+";
}
if (($dob == 1998)) {
my $difference = $dob - 1997;
chomp($difference);
print "You are $difference year younger than my author, Austin.\n"
+;
}
if (($dob == 1996)) {
my $difference = 1997 - $dob;
chomp($difference);
print "You are $difference year older than my author, Austin.\n";
}
if (($dob == 1997)) {
print "You are the same age as my author, Austin!\n";
}
# Asks favorite color.
print "How many people live in your house with you? ";
my $housenum = <STDIN>;
if (($housenum == 5)) {
print "5 people live in my author's house, too!\n";
}
if (($housenum != 5)) {
print "Oh. There are 5 people living in my author's house.\n";
}
chomp($name);
print "Good bye, $name!\n";
Thanks!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|