I'm really new to perl, as in I started reading this book on it 2 weeks ago, so forgive me if I'm asking very basic questions.
I'm trying to get this perl calculator working and I've only just started it, here's the code for it;
Code:
#!perl
print "What would you like to do? \n.1 Add \n.2 Subtract \n.3 Multiply \n.4 Divide";
$choice = <STDIN>;
print "\n"
if ($choice = 1) {
print "What two numbers would you like to add?\n";
print "First: ";
$first = <STDIN>;
print "$first times: ";
$second = <STDIN>;
$result = $first x $second;
print "The result of $first times $second is $result";
}
My question is how do I get the if statement to know wether the user input in $choice is 1?