It looks correct. A few points:
- You might as well use the unix splatline, since winders ignores it anyway: #!/usr/bin/perl
- That style of bracketing and indentation is painful. The recommendations in perlstyle are a good guide to making perl readable to perlers.
- That's good practice reading and checking the $numn variables. I think you should use the same care with $sign.
- This one may be new to you. Instead of all those if statements, you could make an array of code references to what you want to do, given $sign, and call the correct code directly. That would be a form of dispatch table
our @codes = (
sub {},
sub {
my ($n1, $n2) = @_;
print "The Sum of the Numbers $n1 + $n2 is ", $n1 + $n2, "\n";
},
sub {
my ($n1, $n2) = @_;
print "The Difference of the Numbers $n1 - $n2 is ", $n1 - $n2
+, "\n";
},
# . . .
);
$codes[$sign]->($num1, $num2);
- For a further simplification, the different messages could be stored in an array to help unify the different subs. Where things look repetitive, you can generally reduce the problem by removing the repetition.