# An intriguing aspect of this behavior is that it can be # used to implement private method calls. If you put your # class in a module, you can make use of the file's lexical # scope for privacy. First, store an anonymous subroutine # in a file-scoped lexical: # declare private method my $secret_door = sub { my $self = shift; ... }; # Later on in the file, you can use that variable as though # it held a method name. The closure will be called directly, # without regard to inheritance. As with any other method, # the invocant is passed as an extra argument. sub knock { my $self = shift; if ($self->{knocked}++ > 5) { $self->$secret_door(); # *** } }