Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I strongly sympathize with your point of view. There are clearly those out there who write code that is not meant to be read. On the other hand, sometimes unreadable is churned out as a matter of course. From a program I'm currently writing:
%author = map { /^\d{6}$/ ? $_ : [ split( /\|/, $_, 2 ) ] } map { split( /=/, $_, 2 ) } grep { /^\d{6}=[^|]+\|/ } <FH>;
Frankly, I can't say that I'm happy with the illegibility that this code presents to the average programmer. Heck, a few months ago, I wouldn't even have been able to read it. Now, however, I sat down and simply wrote it out. There was only one bug (forgetting the third argument to split) and it worked fine.

While I'll need to stop and read through that when I come across that again, it really seems to be the most straightforward "Perlish" way of writing that. Further, once one develops a high comfort level with Perl, such constructs become (dare I say?) natural.

Much of the trouble that people have with such things stems from the large amounts of punctuation. This has the unfortunate side-effect of steepening Perl's learning curve. Your patience in learning such things, though, will reward you handsomely in the long run as your ability to harness the full power of Perl develops.

Side note: do any monks use English for any production code? I've heard about the module and see how it makes Perl more legible, but I've never seen anyone actually use it.


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

In reply to (Ovid - accidental obfuscation?)Re: Perverse Unreadable Code by Ovid
in thread Perverse Unreadable Code by Anonymous Monk

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (15)
    As of 2018-01-23 17:11 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (250 votes). Check out past polls.