RE: passing an argument to a subroutine

2003-09-09 Thread Mike Harrison
Hi all, I'm a bit late for a reply, but thought it would be appropriate to ask Babs exactly what was required from the perl program. Did you want to print the number of elements in the array, or print each element in the array? As Andrew Brosnan explained, setting a scalar equal to an array name

Re: passing an argument to a subroutine

2003-09-08 Thread R. Joseph Newton
"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

Re: passing an argument to a subroutine

2003-09-05 Thread Todd W.
"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 {

Re: passing an argument to a subroutine

2003-09-04 Thread Andrew Brosnan
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

Re: passing an argument to a subroutine

2003-09-04 Thread Freddy Söderlund
ub do_db { @x = @_; # @x should be "John, mark, Peter" here too, but I get only John. foreach (@x){ insert into group_table (blah blah) values(blah blah); } } -Ursprüngliche Nachricht- Von: Freddy Söderlund [mailto:[EMAIL PROTECTED]

Re: passing an argument to a subroutine

2003-09-04 Thread Sudarshan Raghavan
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

Re: passing an argument to a subroutine

2003-09-04 Thread Rob Anderson
"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

Re: passing an argument to a subroutine

2003-09-04 Thread Freddy Söderlund
- 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 wrong value. What value do you want it