sub unpack_named_later { my ($pos1 ,$pos2 ,%arg) = @_; $pos1 // die("Missing arg!"); $pos2 //= 42; $arg{name1} // die("Missing arg!"); # if you need to unpack hash-args my ($name1,$name2) = @arg{qw/name1 name2/}; # ...etc }