All pastes #638664 Raw Edit

Someone

public text v1 · immutable
#638664 ·published 2007-07-30 00:20 UTC
rendered paste body
#!/usr/local/usr/perl
warnings;
strict;
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')
{
	print ("\n\n");
	print("Your answer is: ","$num1" + "$num2");
	print ("\n\n");
}

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

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

elsif ($maths eq 'divide' or '/')
{
	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>;