All pastes #638685 Raw Edit

Someone

public text v1 · immutable
#638685 ·published 2007-07-30 00:38 UTC
rendered paste body
#!/usr/local/usr/perl
use warnings;
print("\nWelcome to FiendishFish's Simple Perl Calculator.\nTo use this program, just follow the instructions.\n");
print("\nPlease enter the first number for your mathematical calculation:\n");
$num1 = <STDIN>;
chomp ($num1);

print ("\n\nNow enter the second number for your mathematical calculation:\n");
$num2 = <STDIN>;
chomp ($num2);

print ("\n\nWould you like to add, multiply, subtract or divide these numbers?\n");
$maths = <STDIN>;
chomp ($maths);

if ($maths eq 'add' or $maths eq '+' or $maths eq 'Add')
{
	print ("\n\n");
	print("Your answer is: ","$num1" + "$num2");
	print ("\n\n");
}

elsif ($maths eq 'multiply' or $maths eq 'mult' or $maths eq '*')
{
	print ("\n\n");
	print("Your answer is: ","$num1" * "$num2");
	print ("\n\n");
}

elsif ($maths eq 'subtract' or $maths eq '-' or $maths eq 'minus')
{
	print ("\n\n");
	print("Your answer is: ","$num1" - "$num2");
	print ("\n\n");
	
}

elsif ($maths eq 'divide' or $maths eq '/' or $maths eq 'Divide')
{
	print ("\n\n");
	print("Your answer is: ","$num1" / "$num2");
	print ("\n\n");
}

else
{
print ("\n\nInvalid Mathematical Operator\n\n");
}

print("Program Complete...Closing\n\n");
<STDIN>;