package Some::Class; sub new { my $first_arg = shift; # get the first argument my $class = ref($first_arg) || $first_arg; my $self = {}; # create a new, anonymous reference; bless $self, $class: # bless it into the class return $self; }