sub foo { my %args = (1 == @_) ? (named_arg => shift) : @_; # etc }