This is a Perl question, not a DBI one. The problem is most likely
happening at the point of return from the subroutine. 'return %start;' is
being evaluated in a scalar context because you are assigning the subroutine
return value to $start. Try assigning it to @start or %start instead.
Stepping through your code would help you understand what is happening. Run
'perldoc perldebug' to see how to use the built-in debugger. The 'r'
command would be especially interesting in this case, but there are a lot of
useful commands (e.g., 'n', 's', 'x', 'b', and 'c').
"Programming Perl", "Programming the Perl DBI", and "The Perl Cookbook"
would be good investments for you.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
----- Original Message -----
From: "Xiaoxia Dong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 8:04 AM
Subject: pass array into subroutine
> I passes array to one of the subroutine in the main perl file.
>
> this is what is looks like: @ARGV= ('aa', 'bb');
> $start = &initStart(@ARGV);
>
> sub initStart {
> while (@_) {
> do some thing.....
> }
> return %start;
> }
>
> It only pass the first value in @ARGV, that is 'aa', never get to 'bb'.