programming-examples/perl/Class/How to create an object.pl
2019-11-15 12:59:38 +01:00

12 lines
262 B
Perl

#First we create an anonymous hash,
#then bless it into a package
package House;
my $ref = { "Owner"=>"Tom",
"Price"=>"25000", # Properties/attributes
};
bless($ref, House);
print "\$ref is: $ref.\n";
print ref($ref), ".\n";