in reply to Using an object's value instead of a global variable

This might do what you want. It allows you to create multiple instances, and it allows the mascot method to print the value of that instance. You can also call animal as either a straight sub or a method, and either way it modifies the value that will be printed if you later call the_mascot as a straight sub. This is different from what you described, but what you described left quite a lot of ambiguity about whether it's ever legal to create more than one instance of this class, as others have mentioned. Like johnnywang I use a file-scope lexical instead of a package global.
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}; }