Slashdot Mirror


The Road To Better Perl Programming: Chapter 4

Frank writes: "This series of articles on developerWorks comprises a complete guide to better programming in Perl. In this fourth installment, Teodor introduces functional programming and several essential Perl idioms important for Perl programmers looking for speed and elegance in their code, such as the map() and grep() functions, and the Schwartzian and Guttman-Rosler transforms."

3 of 9 comments (clear)

  1. Kind of weak by gizmo_mathboy · · Score: 2, Informative

    I wasn't sure if he teaching "intro to perl" or "intro to functional programming".

    It bugged me when he used map() in a void context (listing 3). It's even in the Perl FAQ that it's frowned upon.

    I would call the article "idiomatic perl" instead.

    1. Re:Kind of weak by pudge · · Score: 4, Informative
      It bugged me when he used map() in a void context (listing 3). It's even in the Perl FAQ that it's frowned upon.

      Perhaps it is, but the primary reason it is frowned upn is because map in a void context returned a list, so it was inefficient. That behavior's been changed; map in a void context is no longer a technical problem. Now it is merely a stylistic one.

  2. a light dawns... by sohp · · Score: 2, Interesting

    Nice nice article. Despite having used Perl for a number of years and become quite proficient in most parts of the language, I never really "got" the use of map and grep. Zlatanov's two central tips, "read from right to left" and "it's like foreach without an explicit looping condition" finally brought the principles home to me. I can finally read and understand The Schwartzian Transform!