The "without using a regex" really smells like homework, unless there's more motivation for it. As the other examples have shown here, most people would simply use a regex. What do you find disturbing about using such?

-- Randal L. Schwartz, Perl hacker


Update: ok, so it may or may not be homework. But I'm still confused about why people ask for pessimized solutions. I really had a legitimate curiousity about the unstated motivation to use something other than an optimal solution. So far, I only know of ignorance, homework, or a hidden subtext to be reasons. This might have been something else, but I don't know until I ask.

In reply to Re: Splitting a String into n-character parts, without using a regex by merlyn
in thread Splitting a String into n-character parts, without using a regex by leons

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.