sub copy { my $self = shift; my $copy = ref($self)->new(%$self, @_); # Do stuff return $copy; } sub new { my $class = shift; return bless ({ NAME => '', USERNAME => '', # etc @_ # allows overriding defaults in the constructor :-) }, $class); }