now that you show the actual data, I would just get the nums from the end of the lines via match global, thusly:
use strict; use warnings; my $str = 'Adam Knowles|||https://www.site.com/?ID=11977|||11977~~~Ale +x Burleson|||https://www.site.com/?ID=27627|||27627~~~Billy|||https:/ +/www.site.com/?ID=18836|||18836~~~Billy|||https://www.site.com/?ID=18 +836|||18836~~~Christopher Duarte|||https://www.site.com/?ID=14713|||1 +4713~~~Dave Martin|||https://www.site.com/?ID=5590|||5590~~~Drew Ruba +do|||https://www.site.com/?ID=26867|||26867~~~Emily Hanson|||https:// +www.site.com/?ID=6782|||6782~~~James Gehrke|||https://www.site.com/?I +D=7834|||7834~~~Jeff Banta|||https://www.site.com/?ID=11446|||11446~~ +~Jeffrey P Sandoval|||https://www.site.com/?ID=14637|||14637~~~Jesse +Bollinger|||https://www.site.com/?ID=8034|||8034~~~Jonathan Walker||| +https://www.site.com/?ID=4811|||4811~~~Jordan Hall|||https://www.site +.com/?ID=12549|||12549~~~Joseph Dodds|||https://www.site.com/?ID=2621 +1|||26211~~~Mark Tappan|||https://www.site.com/?ID=5370|||5370~~~Mary + Christine Hammill-Perkins|||https://www.site.com/?ID=15901|||15901~~ +~Mary E. Boesch|||https://www.site.com/?ID=20326|||20326~~~Matthew Sm +ith|||https://www.site.com/?ID=26752|||26752~~~Matthew Tuggle|||https +://www.site.com/?ID=13170|||13170~~~Moises Cariaso|||https://www.site +.com/?ID=27397|||27397~~~Nicole Masciola|||https://www.site.com/?ID=2 +7230|||27230~~~Paul Zenns|||https://www.site.com/?ID=8396|||8396~~~Pa +ul Zenns|||https://www.site.com/?ID=8396|||8396~~~Phillip Scott|||htt +ps://www.site.com/?ID=5015|||5015~~~Ross Martin|||https://www.site.co +m/?ID=27192|||27192~~~Sam Lavine|||https://www.site.com/?ID=26277|||2 +6277~~~Stephen Beatty Jr|||https://www.site.com/?ID=10557|||10557~~~T +ODD A PARTIN|||https://www.site.com/?ID=21876|||21876~~~'; my @favnums = $str =~ /\|\|\|(\d+)~/g; $#favnums = 24 if ($#favnums >24); #maximum of 25 fav's my $favnumstr = join ",",@favnums; print $favnumstr; 11977,27627,18836,18836,14713,5590,26867,6782,7834,11446,14637,8034,48 +11,12549,26211,5370,15901,20326,26752,13170,27397,27230,8396,8396,501 +5

In reply to Re^3: Limit loop by Marshall
in thread Limit loop by htmanning

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.