in reply to Re: passing array as an argument
in thread passing array as an argument
Another thing is that, for performance reason, even there is only one parameter, it is still a good idea to pass array ref, instead of array.
(davido didn't mention this simply because this was not asked in the original post)
my @numb = (1..100); print sum(\@numb); sub sum { my $numb = shift; my $total; foreach (@$numb) {$total += $_}; return $total; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: passing array as an argument
by sauoq (Abbot) on Oct 31, 2003 at 00:48 UTC |