On 09/06/10 13:14 +0530, Gopal Karunakar wrote:
    How can i declare a simple perl script file which will take arguments
from the user? an example will be take two numbers and give the sum as
output.

use strict;

print calc(@ARGV);

sub calc {
  my @to_add = @_;
  my $i = 0;
  for my $num(@to_add) {
    $i += $num;
  }
  return $i;
}

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to