programming-examples/perl/Class/Our First Constructor.pl

20 lines
281 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
package Person;
use warnings;
use strict;
sub new {
my $self = {};
bless ($self, "Person");
return $self;
}
1;
#Now we can use our Person class to create an object:
#/usr/bin/perl
use warnings;
use strict;
use Person;
my $person = Person->new();