in reply to Re: Simple Arithmetic Question
in thread Simple Arithmetic Question
This is what I have so far I'm not sure how to use the chomp exactly so I'm sure that is wrong. It keeps showing a Global symbol "c" requires explicit package name in lines 14 and 17. I'm sure there are probably multiple errors in the code but I can't figure it out. If you have any pointers that would be great thanks!!
#!/usr/bin/perl use Modern::Perl; use strict; use warnings; print "input three numbers separated by spaces\n"; my $user_input = <>; chomp $user_input; my ($nr1) = $user_input, "$a"; chomp $user_input; my ($nr2) = $user_input, "$b"; chomp $user_input; my ($nr3) = $user_input, "$c"; print "The sum of the three numbers is equal to", ($a+$b+$c),"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Simple Arithmetic Question
by AnomalousMonk (Archbishop) on Nov 06, 2014 at 04:24 UTC | |
|
Re^3: Simple Arithmetic Question
by Anonymous Monk on Nov 06, 2014 at 04:02 UTC | |
|
Re^3: Simple Arithmetic Question
by Laurent_R (Canon) on Nov 06, 2014 at 07:26 UTC |