print "input three numbers separated by spaces\n"; my $user_input = <>;
This is good as far as it goes: you're getting something | a string from STDIN that is terminated by a newline.
chomp $user_input;
This is good too, except you do it twice more and this is where you start to go off the rails. chomp removes a newline (if present) from the end of a string (well, it's a little more involved than that, but let it stand for now), $user_input in this case, so doing it repeatedly will not usually get you anything. For learning/development/debugging, I would advise placing a print statement after this step so you can be sure exactly what you are dealing with:
print "A: '$user_unput' \n";
(In general, develop your code step-by-step and use print statements at each successive step to see just what is happening. If weird stuff starts to happen, understand the problem before proceeding.)
my ($nr1) = $user_input, "$a";
This has no meaning. You are assigning $user_input to $nr1 (why?) and interpolating $a (which has no value at this point) into a string, which you then throw away: what do you think is happening here? (Update: Two other, similar statements have the same problem.)
Please consider these and other points raised so far, write some more code and post again.
Update: Do continue to use strict; and use warnings; in your code (use Modern::Perl; includes both of these). They will make learning Perl much easier.
In reply to Re^3: Simple Arithmetic Question
by AnomalousMonk
in thread Simple Arithmetic Question
by pcoady
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |