sub method { my $self = $_[0]; # leave it alone for obj/hashref unless( ref( $self ) || !$#_ ) { # else is immed. hash or # list of pairs my %opt = @_; $self = \%opt; } # now $self can be processed as a hashref whichever # of the four calling styles was used }