Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal DarkKnightRadick's Journal: My Tribute to Douglas Adams 1

#!/usr/bin/perl -w
#I have a feeling the answer will be 42

print "I have a feeling the answer will be the answer to Life! The Universe! And Everything!\n";
print "Please input the first number:";
chomp($first_num = <stdin>);
print "Please input the second number:";
chomp($second_num = <stdin>);
$answer = $first_num * $second_num;

if ($answer != 42) {
print "$first_num times $second_num is not the answer to Life! The Universe! And Everything! It's actually just $answer\n";
} else {
print "You know the answer to Life! The Universe! And Everything!\n";
}
This discussion has been archived. No new comments can be posted.

My Tribute to Douglas Adams

Comments Filter:

Beware of Programmers who carry screwdrivers. -- Leonard Brandwein

Working...