# file args.pl
sub my_args
{
my $i;
print "My arguments:/n";
for($i=0;$i<=$#_;$i++){
print "Argument $i: $_[$i]/n";
}
print "/n";
}
my $name = "arg one";
my @names = ('This', 'is', 'an', 'array');
my_args($name);
my_args($name, 123);
my_args(123, 345, @names, $name);
My arguments:
Argument 0: arg one
My arguments:
Argument 0: arg one
Argument 1: 123
My arguments:
Argument 0: 123
Argument 1: 345
Argument 2: This
Argument 3: is
Argument 4: an
Argument 5: array
Argument 6: arg one