in reply to Is it a scalar or a hash?

My solution in the past has been either to write 2 functions or else to pull the following trick:
sub foo { my %args = (1 == @_) ? (named_arg => shift) : @_; # etc }
or pull it as follows:
sub foo { my $args = shift; if (! ref($args)) { # <- test depends on usage $args = {named_arg => $args); } # etc }
Now it can be called two ways. Internally that is turned into a hash of named arguments, and then I can proceed to supply defaults for whatever is missing.