package FOO ; use strict qw(vars); use vars qw($VERSION) ; $VERSION = '0.01' ; sub new { ## The class name: my $class = shift ; ## Arguments when creating the object: my ( $arg1 , $arg2 , @rest ) = @_ ; ## Define from what package this object will be: my $this = bless({} , $class) ; ## Define some internal value/attribute in the object: $this->{FOO} = $arg1 ; ## Return the created object: return $this ; } sub methodx { ## The object reference: my $this = shift ; ## Arguments of this method: my ( $arg1 , $arg2 , @rest ) = @_ ; ... } 1;