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 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
make sure you don't overwrite variables.
That's what I can think of right now.
- Original Message -
From: "B. Fongo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 04, 2003 12:32 PM
Subject: AW: passing an argument to a subroutine
I assigne
[EMAIL PROTECTED]
Gesendet: Donnerstag, 4. September 2003 11:46
An: [EMAIL PROTECTED]
Betreff: Re: passing an argument to a subroutine
- Original Message -
From: "B. Fongo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, Septembe
B. Fongo wrote:
Hello
Please don't cross post
An argument passed to a subroutine returns wrong value.
Code example:
@x = (1..5);
$x = @x;
You are trying to assign an array to a scalar. An array evaluated in a
scalar context gives the no elements present in it. In this case the
value 5 will b
"B. Fongo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello
Hi
>
> 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 $forwa
- Original Message -
From: "B. Fongo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, September 04, 2003 11:34 AM
Subject: passing an argument to a subroutine
> Hello
>
> An argument passed to a subroutine returns wr
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?
10 matches
Mail list logo