[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[Fun With Perl] You don't need to understand this...



At 04:52 -0700 06/11/1999, Randal L. Schwartz wrote:
>
>Why do people do this?  I see it in my class all day.  Why do people
>*ever* put a statement in a program that they don't understand!?

I am reminded of a piece of (large) Perl code I was reviewing about a year ago.

It was written by someone (on contract no less!) who was given the 
project because he had said he wanted to learn Perl :-}

Working through the code... very C-ish code... I found:

    @filelist = grep !/^\.\.?$/, readdir DIR;

I looked at this line and, well, it just didn't fit. It was cool and 
idiomatic and... (Note that, at that time, I hadn't personally ever 
used this lovely idiom. It's in my regular toolbox now).

I sat there and scratched my head and said "Where did _this_ 
programmer come up with _that_ bit of code...?" It's in the Camel.

Thanks to Larry, Tom, and Randal for all the nice explanations. The 
Camel lets people put statements into their code that they don't 
understand... but they work anyway :-)   (this may be a two-edged 
sword of course ... :)

-- --
        |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
  ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
       |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
      '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.org

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org

</x-flowed>