|Pathologically Eclectic Rubbish Lister|
Re^4: Limit loopby pryrt (Abbot)
|on Aug 30, 2022 at 21:44 UTC ( #11146517=note: print w/replies, xml )||Need Help??|
Your script not working has nothing to do with whether or not the loop properly exits after a maximum of 25 loops.
You need to fix your bugs before declaring that someone's solution for a small question is invalid.
Thi spoiler contains an SSCCE that fixes (some) of your mistakes, with comments. But in brief, you didn't use strict and warnings, so you missed some of the problems; you initialized the wrong variable outside of your loop (which would have been caught by strict/warnings);
The code below shows the same loop working for both 5 favorites in the string (showing all) and for 30 favorites in the string (showing 25 of them).
<Reveal this spoiler or all in this thread>
edit: struck about the vertical bar; the eventual follow-on data shows that there really are 3 bars between fields. Sorry.
In Section Seekers of Perl Wisdom