Constructor Arguments Sometimes an object cannot be created without some initialization data. A constructor can be defined to take arguments to be used as initialization data: sub new { my ($class, $foo, $bar) = @_; return bless {foo => $foo, bar => $bar}, $class; } Will allow a new Foo::Bar object to be constructed with its foo and bar data members properly initialized: $object = Foo::Bar->new("my foo", "my bar");