programming-examples/perl/Class/Our First Constructor.pl
2019-11-15 12:59:38 +01:00

20 lines
281 B
Perl

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();