"B. Fongo" wrote: > Hello > > An argument passed to a subroutine returns wrong value. > > Code example: > > @x = (1..5); > $x = @x; > > showValue ($x); # or showValue (\$x); > > sub showValue { > > my $forwarded = @_; > print $forwarded; # print ${$forwarded}; > > } > > In both cases, the script prints out 1. > What is going on here?
Nothing, at least not with the execution of your program. Your print statement is doing exactly what you tell it to do. It is printing the value stored in $forwarded, which is the number of items in the argument list. Since you called the function with one element, the number 5, this is correct. There is one very big problem with your code, though. It is missing something. The time to: use strict; use warnings; is with your first Perl program, and every program you write thereafter. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]