Paradizingmania has asked for the wisdom of the Perl Monks concerning the following question:
hey guys i have just started learning perl, and i dont know much more than her (so dont use complicated answers or scripts) thanks in advance
#!/usr/bin/perl use strict; use warnings; print "please enter number 1 = "; my $num1 = <STDIN>; print "please enter operation = "; my $opr1 = <STDIN>; print "please enter number 2 = "; my $num2 = <STDIN>; if ($opr1 eq '+'){ print "$num1 $opr1 $num2 = " . ($num1 + $num2) . "\n"; } if ($opr1 eq '-'){ print "$num1 $opr1 $num2 = " . ($num1 - $num2) . "\n"; } if ($opr1 eq '*'){ print "$num1 $opr1 $num2 = " . ($num1 * $num2) . "\n"; } if ($opr1 eq '/'){ print "$num1 $opr1 $num2 = " . ($num1 / $num2) . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: calculator help
by Lady_Aleena (Priest) on Jun 01, 2014 at 20:13 UTC | |
by RonW (Parson) on Jun 02, 2014 at 16:57 UTC | |
|
Re: calculator help
by Anonymous Monk on Jun 01, 2014 at 18:23 UTC | |
by Anonymous Monk on Jun 01, 2014 at 18:29 UTC | |
by RonW (Parson) on Jun 02, 2014 at 16:51 UTC | |
|
Re: calculator help
by Laurent_R (Canon) on Jun 01, 2014 at 22:35 UTC | |
by GrandFather (Saint) on Jun 03, 2014 at 10:28 UTC | |
by Laurent_R (Canon) on Jun 03, 2014 at 17:52 UTC | |
by GrandFather (Saint) on Jun 04, 2014 at 00:50 UTC | |
|
Re: calculator help
by AnomalousMonk (Archbishop) on Jun 02, 2014 at 00:26 UTC |