EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: passing an argument to a subroutine
Hello
An argument passed to a subroutine returns wrong value.
Code example:
@x = (1..5); [Mike: @x = (1,2,3,4,5)]
$x = @x; [Mike: $x = 5, the number of elements in @x]
showValue ($x); # or showValue (\$x); [Mike: pa
"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 s
"B. Fongo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello
>
> An argument passed to a subroutine returns wrong value.
>
> Code example:
>
> @x = (1..5);
> $x = @x;
>
here, $x gets the number of elements in @x
>
> showValue ($x); # or showValue (\$x);
>
>
> sub showValue {
On Thursday, Sep 4, 2003, at 04:53 US/Pacific, Andrew Brosnan wrote:
On 9/4/03 at 11:34 AM, [EMAIL PROTECTED] (B. Fongo) wrote:
An argument passed to a subroutine returns wrong value.
Code example:
[..]
In both cases, the script prints out 1.
What is going on here?
You are asking Perl for the numb
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
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?