in reply to Re^3: Limit loopin thread Limit loop
Before the loop remove the excess elements
splice @favs, 25; foreach (@favs){ [download]
splice @favs, 25; [download]
Note that splice-ing past the end of the array results in a warning in earlier Perl versions:
Win8 Strawberry 5.8.9.5 (32) Wed 08/31/2022 15:05:47 C:\@Work\Perl\monks >perl -wMstrict -MData::Dump=dd -le "my @ra = ('a' .. 'd'); splice @r +a, 10; dd \@ra" splice() offset past end of array at -e line 1. ["a" .. "d"] [download]
Give a man a fish: <%-{-{-{-<