package Mascot; use strict; use Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(the_mascot); my $value = "camel"; sub the_mascot { my $data = shift || $value; print<<"END"; Hey, did you know that Perl's mascot is a: $data END } sub new { my $class = shift; my $self = {}; $self->{ANIMAL} = $data; bless($self, $class); return $self; } sub animal { my $self = shift; my $newval; if (ref $self eq __PACKAGE__) { $self->{ANIMAL} = $newval = shift; } else { $newval = $self; } $value = $newval; } sub mascot { my $self = shift; the_mascot $self->{ANIMAL}; }