in reply to Pass on name of array
Note that this function has a prototype which tells Perl that you don't want the array (@), but a reference to it. Without this prototype, the contents of the array are passed to the function, which is of less use.sub DoSomethingToArray (\@) { my ($array) = @_; for ($br = 0; $br <= $#{$array}; $br++) { # Do stuff with @$array using references } } # Call it simply as: DoSomethingToArray(@config::a); DoSomethingToArray(@config::b); DoSomethingToArray(@config::c);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pass on name of array
by ton (Friar) on Apr 05, 2001 at 21:49 UTC | |
by merlyn (Sage) on Apr 05, 2001 at 21:52 UTC | |
by tilly (Archbishop) on Apr 06, 2001 at 12:29 UTC |