package House; # Class sub new { # Class method called a constructor my $class = shift; my $ref={ "Owner"=>undef, # Attributes of the object "Price"=>undef, # Values will be assigned later }; bless($ref, $class); # $ref now reference an object in this class return $ref; # A reference to the object is returned } 1; #### #!/usr/bin/perl -w use lib ("/home/hamidjon/Perl/Learning/code_examples/myModules"); use House; my $houseref = House->new(); print "\$houseref in main belongs to class ", ref($houseref), "\n";