in reply to Re^2: Subroutine help
in thread Subroutine help

Where's your code to prompt for and read the six numbers? We can't help you if you don't show us your code.

Replies are listed 'Best First'.
Re^4: Subroutine help
by hackernet1337 (Initiate) on Aug 24, 2009 at 01:17 UTC
    use strict; use warnings; sub AddNumbers { my ($first_number, $second_number, $third_number, $fourth_number, +$fifth_number, $sixth_number) = @_; my $add = $first_number + $second_number + $third_number + $fourth +_number + $fifth_number + $sixth_number; return $add; } my $sum = AddNumbers( 1, 2, 3, 4, 5, 6 ); print "The sum of input numbers equals to: $sum \n";
    Heres the code, i want to be able to get input from user and get them added and output to be shown.
      I was not clear; sorry.

      You specify my $sum = AddNumbers( 1, 2, 3, 4, 5, 6 ); As a result, you will always get 21 as an answer.

      If you ever hope to see a different answer, you need to specify six variables (or an array of values). In order to do that, you need to prompt the user for the values, and then inout those values.

      If you want us to help you fix the software that does that, you need to show us the software first. The code you reposted does not prompt the user, neither does it input anything.