$S{light}->($self, 10); #### $self->light(10) #### sub AUTOLOAD { my $self = shift; my @args = @_; # Retrieve the method name, without the Package name my $name = our $AUTOLOAD; $name =~ s/.*://; # Check if this is one of the functions we declared croak "Undefined method : $name" if !$S{$name}; # Call the appropriate method return $S{$name}->($self, @args); } #### $obj->light(10); #### foreach my $name (@names) { my $name = $S{$name}; }