There's a lot going on with even a simple example, so I'd really recommend reading perlboot and possibly perltoot, but the following is a basic object implementation:
File: Foo.pm
package Foo;
use strict;
use warnings;
sub new {
return bless {};
}
sub method {
return "The value returned by method";
}
return 1;
and the script
#!/usr/bin/perl
use strict;
use warnings;
use Foo;
my $object = Foo->new();
print $object->method();
|