package MyPackage; use strict; our $VERSION = 0; use Tie::Hash; use base qw(Tie::ExtraHash); # OO Interface sub new { my $class = ref($_[0]) || $_[0]; my $self = bless {}, $class; tie %$self, $class; } sub to_string { join ' ', %{$_[0]}; } # Tie interface sub STORE { $_[0][0]{$_[1]} = ucfirst($_[2]); } 1;