The Class Constructor Method
# Module: House.pm
package House; # Class
sub new { #constructor
my $class = shift;
my $ref={"Owner"=>undef,
"Price" =>undef,
};
bless($ref, $class);
return $ref; # A reference to the object is returned
}
1;
# The User of the Module)
#!/usr/bin/perl
use House;
my $houseref = House->new();
print ref($houseref),".\n";
Related examples in the same category