PhilTest.pm -------------------8<------------------------- #!/usr/bin/perl package PhilTest; use strict; sub new { my $self = {}; $self->{v} = undef; bless($self); return $self; } sub inc { my $self = shift; $self->{v}++; } 1; ------------------->8------------------------- testpkg.pl -------------------8<------------------------- #!/usr/bin/perl use PhilTest; $m = new PhilTest; $m->{v} = 1; print "m->v = " . $m->{v} . "\n"; $m->inc(); print "m->v = " . $m->{v} . "\n"; ------------------->8------------------------- Output: $ perl testpkg.pl m->v = 1 m->v = 2