#!/usr/bin/perl

print ”
“;
print “################################################
“;
print “## ##
“;
print “## Welcome to the Numbers Game ##
“;
print “## By Brett Lee-Price ##
“;
print “## ##
“;
print “## Rules: Enter 3 Numbers between 0 and 999, ##
“;
print “## The first Answer will be the ultimate ##
“;
print “## Answer as well! No matter which numbers ##
“;
print “## you enter, it's guaranteed! ##
“;
print “## ##
“;
print “################################################
“;

print ”
“;
print “Please enter Number One: “;
$Input[0] = ; # Input one
$Number[0] = $Input[0] + 1998; #Number one being calculated.
while ($Input[0] <=0 || $Input[0] >= 1000) #While Statement for Number One
{
print “An Invalid Number was entered. Please Re-enter Number One: “;
chomp ($Input[0] =);
$Number[0] = $Input[0] + 1998;
$count = $count + 1;
if($count == 4) {
print ”
“;
print “Too many invalid attempts! Terminating Program.”;
print ”
“;
exit;
}
}
print “The Ultimate Answer will be: ${Number[0]}.”; #Ultimate Answer
print ”
“;

print “Please enter Number Two: “;
$Input[1] = ; #Input Two
$Number[1] = 999 - $Input[1]; #Number two being calculated.
$Final[0] = $Input[0] + $Input[1] + $Number[1]; #Part One of Final being worked out with Input One, Two And Answer of Two.
while ($Input[1] <=0 || $Input[1] >= 1000) #While Statement for Number two
{
print “An Invalid Number was entered. Please Re-enter Number Two: “;
chomp ($Input[1] =);
$Number[1] = 999 - $Input[1];
$Final[0] = $Input[0] + $Input[1] + $Number[1];
$count = $count + 1;
if($count == 4) {
print ”
“;
print “Too many invalid attempts! Terminating Program.”;
print ”
“;
exit;
}
}
print “Second answer is: ${Number[1]}.”; #Answer Two
print ”
“;

print “Please enter Number Three: “;
$Input[2] = ; #Input Three
$Number[2] = 999 - $Input[2]; #Number Three being calculated.
$Final[1] = $Input[2] + $Number[2]; #Part Two of Final being worked out with Input Three and Answer Three.
while ($Input[2] <=0 || $Input[2] >= 1000) #While Statement for Number Three
{
print “An Invalid Number was entered. Please Re-enter Number Three: “;
chomp ($Input[2] =);
$Number[2] = 999 - $Input[2];
$Final[1] = $Input[2] + $Number[2];
$count = $count + 1;
if($count == 4) {
print ”
“;
print “Too many invalid attempts! Terminating Program.”;
print ”
“;
exit;
}
}
print “Third answer is: ${Number[2]}.”; #Answer Three
print ”
“;
$Ultimate = $Final[0] + $Final[1]; #Ultimate Answer being calculated.
print ”
“;
print “The Ultimate Answer is: ${Ultimate}.
“; #Ultimate Answer is displayed.
print ”
“;
print “Add every number asides from the first answer!
“;
print “See? Magic!
“;
print ”
“;
print ”
“;

Edit: Looks somewhat ugly here due to the formatting, etc. I've included a better looking and working version here!