in reply to Re: reference to self function
in thread reference to self function

I didn't know about "can" - that's pretty neat. But I'd really like to make a reference I can store, since I'll be calling the "method" function throughout the program; what I have in the meantime looks like this:
sub w { my($self, $a, $i) = @_; if($self->{method} eq 'correlation') { return $self->correlation($a, $i); } if($self->{method} eq 'vector_similarity') { return $self->vector_similarity($a, $i); } if($self->{method} eq 'IUF') { return $self->IUF($a, $i); } if($self->{method} eq 'MSD') { return $self->MSD($a, $i); } }
The w function gets called quite a few times, so I don't want a per-call check.

Thanks for the tip on constructors; that's a good point.

dan