Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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.

Cheers,
Ovid

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

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2014-12-27 14:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls