Beginning problems with multiple arguments

I'm trying to write a command whose code is determined by the number of arguments the user inputs. Each argument is to be a number. The program is supposed to multiply, add, and subtract all of the arguments whether there are two, three, four, five, etc arguments. How do I use the user inputs? How do I code for an array of indeterminate length?

Basically, the user inputs a set of numbers of any size. The programs calculates the sum, product, and the difference of the numbers.

Everything has been said, just one last point: in Perl, an array will automatically grow to the size required to store all its elements. This of course applies to the @ARGV array, whose size will automatically be the number of arguments passed to the script.

the first element of an array has index 0, not 1. So you should initially assign $difference to $ARGV[0], not $ARGV[1].

I think your for loop is probably broken, but have no time now to test it. I would rewrite this part of your code like this:

Perl Code:

my$difference=shift@ARGV;# now $difference holds the first item of the @ARGV array and # this value has been removed from the array, so that the array# now contains only the operands to be subtracted.foreachmy$value(@ARGV){$difference-=$value;}# do the printing job

the first element of an array has index 0, not 1. So you should initially assign $difference to $ARGV[0], not $ARGV[1].

I think your for loop is probably broken, but have no time now to test it. I would rewrite this part of your code like this:

Perl Code:

my$difference=shift@ARGV;# now $difference holds the first item of the @ARGV array and # this value has been removed from the array, so that the array# now contains only the operands to be subtracted.foreachmy$value(@ARGV){$difference-=$value;}# do the printing job

Thank you very much for your help. I'm still figuring out the proper syntax here though. For instance, in the code here:
#!/usr/bin/perl
use strict;
use warnings;

my $C=scalar (@ARGV);
if ($C>2) {
print "There are more than two arguments! \n";
}

my $Sum=0;
print "The values entered are @ARGV \n";
foreach( @ARGV )
{
$Sum += $_;
}
print "The sum of the values is $Sum,";
print "\n";
#I had assistance for this part
my $Difference=shift @ARGV;
foreach my $i ( @ARGV ){
$Difference-=$i;
}
if ($Difference<0) {
print "The difference of all of the arguemnts is a negative number.";
}
if($Difference>0){
print "The difference of the values is $Difference \n";
}