package Original; sub new { my $class = shift; my $other = shift; # hash ref, optional my $self = { name => 'the original', rating => 'supreme commander', boots => 'laced to the knee', }; if ($other) { foreach (keys %$other) { $self{$_} = $other->{$_}; } } bless($self, $class); return $self; } sub copy { my $self = shift; return $self->new($self); }