The usual rationale for Perl's extreme syntactic flexibility is that, while it can lead to some truly hideous code (and utterly unreadable obfuscations), it also allows the clever programmer to write truly beautiful code.

I'm trying to illustrate this on the Perl page of a new version of my personal site (which I expect to be viewed mainly by experienced Internet users who haven't done any "programming" more complicated than HTML). Problem is, I'm not even sure where to look. So my question is, what beautiful Perl code have you seen? Suggestions should be for functioning code, not Perl poetry. For the purposes of the site, I'm hoping to find short snippets that read well to somebody who doesn't know Perl, but I'd also be interested to hear about cases where the beauty extends beyond the scope of a dozen or so lines.

=cut
--Brent Dax
There is no sig.


In reply to Beautiful Perl by BrentDax

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.