Perl6: variable number of arguments to function/subroutine

后端 未结 3 1688
情深已故
情深已故 2021-01-11 13:29

I want to be able to run a function with a variable number of parameters in Perl6, but after reading through https://docs.perl6.org/language/functions#Arguments I don\'t see

3条回答
  •  青春惊慌失措
    2021-01-11 14:09

    You can use signature destructuring

    sub some-test(*@all [$first, *@rest]) { ... } # must have 1 or more parameters
    

提交回复
热议问题