in reply to Re: passing a value to a function
in thread passing a value to a function
Since you already made some great points about calling and global variables, I'd like to add a bit about the algorithm. First the cleararray sub can be shortened:
sub cleararray { my $self = shift; @{$self->array()}[$_] = [(0) x $self->radiovar()] for 0 .. $self->radiovar() - 1; }
Second, it may not be necesary to use $self->radiovar() if $self->array() is already defined for size:
sub cleararray { my $self = shift; @{$self->array()}[$_] = [(0) x @{$self->array()}] for 0 .. @{$self->array()} - 1; }
|
|---|