sub test { my ($self, @args) = @_; my %params; if (@args > 1) { %params = @args; # Will warn if @args has an odd number of elements } else { ... # Handle single argument } } #### test ({this => 1, that => 2}); sub test { my ($self, $args) = @_; my %params; if ('HASH' eq ref $args) { %params = %$args; } else { ... # Handle single argument } }