in reply to Avoiding empty HASH ref. errors

Here's another way.
my $obj = Class->new(); my $obj2 = Class->new(string => 'foo', num => 11); package Class; sub new{ my $class = shift; my $attr = { @_ }; bless $attr, $class; }

UPDATE (UTC 0800):

Of course, this doesn't really solve your problem -- you pass a hash reference as "prototype" when creating your object, I pass the hash itself. My "solution" would change your interface; this might not be possible for you.