in reply to Fill array
push (@right_array, $row[1]);Or, something like this where you are adding the row to the @right_array:
push (@right_array, \@row);Probably what you mean by @right_array is that you want to specify which array to put the stuff into, correct?
This is achived by using references. Instead of knowing exactly which array you are going to be using, you have a handle to it ($right_array versus @right_array) that you can use like an array with the proper prefix (@$right_array).sub fill_array(\@) { my ($right_array) = @_; # ... while (my @row = $sth->fetchrow_array()) { push (@$right_array, \@row); } # ... } # As a test fill_array (@name);
Maybe this is what you had in mind?my @row = @{$name[1]}; # Row 1 my $row_item_1 = $name[1][1]; # Row 1 column 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Fill Arbitrary Array
by Anonymous Monk on May 02, 2002 at 13:55 UTC | |
by tadman (Prior) on May 02, 2002 at 17:22 UTC | |
|
Re: Re: Fill Arbitrary Array
by Anonymous Monk on May 02, 2002 at 09:53 UTC |