Is there a less clumsy alternative for copying up to “n” array elements?

前端 未结 5 1129
名媛妹妹
名媛妹妹 2021-01-11 13:57

In a world of many @choices
With a $limit to what one can do,
Life proposes many @options
But at time

5条回答
  •  轮回少年
    2021-01-11 14:05

    my @choices = @options[0..min($#options, $limit-1)];
    

    Short, straightforward, clear.

提交回复
热议问题