package Hello::World;
use warnings;
use strict;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(greetings);
sub greetings {
return "Hello, World";
}
1;
####
package Hello::World2;
use warnings;
use strict;
sub new {
my $class = shift;
my $self = { greeting => shift, };
return bless $self, $class;
}
sub the_greetings {
my $self = shift;
return $self->{greeting};
}
1;
##
##
#!/usr/bin/perl
use warnings;
use strict;
use Hello::World;
use Hello::World2; ## OOP
print greetings(); ## prints Hello, World
print $/;
my $greet = Hello::World2->new("Hello, World, Again");
print $greet->the_greetings(); ## prints Hello, World, Again