On 9/4/03 at 11:34 AM, [EMAIL PROTECTED] (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?
You are asking Perl for the number of elements in @_.
If you want the value(s) from @_, then
my $forwarded = shift;
or
my ($forwarded) = @_;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]