in reply to Making program readable
Hello ravi45722,
Here I cant use "sub" because in error sections the @network array, @subscriber array, @system errror is too big to pass to a function. It may slow down or even memory outage sometimes.
In Perl, arguments to subroutines are passed by reference, not by value. Within the sub, the special variable @_ contains aliases to the passed-in arguments. It’s usual practice to begin by making local copies:
my ($arg1, $arg2, ...) = @_;
but that isn’t required: you can always access the arguments directly as $_[0], $_[1], etc.
OK, so there’s still some overhead involved in making the aliases (I haven’t benchmarked it). But you can bypass most of this overhead by passing an array reference instead of an array:
sub some_function { my ($network_ref, $subscriber_ref, $system_ref) = @_; for (@$network_ref) { ... } ... } ... some_function(\@network_error, \@subscriber_error, \@system_error);
See perlsub.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|