Introduction to Perl

Introduction to Perl

Lesson Three


#Script Week 3
#!usr/bin/perl

system "cls"; # use "cls" for Windows/DOS
# system "clear"; # use for Linux/UNIX

$NAME = "Magiluna";

print "\nIf you can guess today\'s secret name, you can access this site.\n";

if ($NAME eq "Magiluna") {
   print "\tHello $NAME... Welcome back!\n";
}
elsif ($NAME eq "Luna") {
   print "\tAccess denied! Go away!\n";
}
else {
   print "\t$NAME is not a valid username.\n";
}

print "\nIf you can guess today\'s secret name, you can access this site.\n";

$NAME = "Luna";

if ($NAME eq "Magiluna") {
   print "\tHello $NAME... Welcome back!\n";
}
elsif ($NAME eq "Luna") {
   print "\tHey $NAME! Access denied! Go away!\n";
}
else {
   print "\t$NAME is not a valid username.\n";
}

print "\nIf you can guess today\'s secret name, you can access this site.\n";

$NAME = "Binky";

if ($NAME eq "Magiluna") {
   print "\tHello $NAME... Welcome back!\n";
}
elsif ($NAME eq "Luna") {
   print "\tAccess denied! Go away!\n";
}
else {
   print "\t$NAME is not a valid username.\n";
}

$correct = "Santa Clarita";
# The value of $answer is unknown, we need to get user input

print "\n\nShatterpath was born in Las Vegas.\n";

if ($answer ne $correct) {
   print "\tSorry, the correct answer is $correct\n";
}
else {
   print "\tRight! $answer is where Shatterpath is from!\n";
}

$cheese = "I like games!";
$game = "\'nother game";

print "\n\nWhat is Cheese\'s favorite saying?\n";
print "\t$cheese";
print "\n\nWhat does Cheese say when he\'s following Bloo?\n\t";
print "$game" x 4;

$user = "Wahkeena";
print "\n\n\n$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";
chop($user);
print "$user\n";

$Fact = "Wahkeena means \'most beautiful\' in the Yakima language.\n";
chomp($Fact);

print "What do you get when you put 2 breeding age rats together?\n";
print "\tYou get ";
print "2"+ 10;
print " rats, including 10 little squeakers.\n";
print "\t\tOn average.\n";