[Purdue-pm] Purdue Perl Mongers challenge problem

Mark Senn mark at purdue.edu
Wed May 1 12:26:37 PDT 2019

for Challenge #1 of this week's Perl Weekly Challenge:
    Create a script which takes a list of numbers from command line and
    print the same in the compact form. For example, if you pass
    “1,2,3,4,9,10,14,15,16” then it should print the compact form like

That's interesting but not enough of a challenge.  For the Purdue
Perl Mongers I add an additional criteria:
    You are only allowed to use while loops and s (substitution)
    commands to do the transformation.
In my opinion, this leads to a solution that is more clear
than anything else I've thought of.

In software engineering, I've found that if a problem is in the string
of characters domain in is usually easier to keep it in that domain if
possible---instead of transforming to another domain (that requires more
code), do some computations, and transforming back (even more code).
(An exception is transforming from the time domain to the frequency domain
and back for some kinds of problems.)

I'll send out a link to a blog entry with my solution later.

Hint: use Perl6.


More information about the Purdue-pm mailing list