What is the most pleasant idiomatic way of writing
for (take(100,@array)) {...}
given that there is no take (which takes the first n elements of a list, but fewer if there are not n elements)?
Things I considered:
for (@array[0..99]) {...}but that fails ungraceful if
@arrayhas fewer than 100 elementsfor (@array[0..min(99,$#array)]) {...}but
minis not a standard function in Perlfor (splice @array,0,100) {...}bu that changes the array.