Anna Shipman : JFDI

Learning the perls

20 November 2012

After some time muddling through with Perl, I have accepted the inevitable – it's time to actually knuckle down and learn it properly. I have acquired some books, but I also require some direction – so I asked my excellent colleague and friend Mark Norman Francis to write a brief guest post for my blog.

His instructions were "Complete the sentence: In order to understand C you need to understand Pointer Arithmetic. In order to understand Perl you need to understand...". He went many better, and produced the following:

In order to write perl in a modern context, I think these are the basic skills you'll need.
  1. Perl's provided documentation is extensive and worthwhile, so learn to use `perldoc` to read both the provided manuals and the documentation of the builtin perl functions.
  2. Learn the difference between variables – scalar, array, hash, and references (hint for references: learn to make a hash of hashes).
  3. Learn how to use an array as a stack.
  4. Basic regular expression usage – matching, replacing, capturing substrings, case-insensitivity, metacharacters, and writing more readable expressions by having perl ignore the whitespace.
  5. Learn to use perl on the command line as a pipe filter instead of awk/sed.
  6. Learn how to write your own functions.
  7. Learn how to use core modules such as `File::Find` (write a tool to list files in a directory structure from smallest to largest in size).
  8. Refactor the code from step 7 to use a Schwartzian Transform to sort the file sizes.
  9. Learn how to install third-party libraries from CPAN.
  10. Install Moose from CPAN, then work through `Moose::Manual` and `Moose::Cookbook` to learn to write modern OO perl.
  11. Learn how to use `Test::More` to test code and `Devel::Cover` to produce coverage reports.
  12. Find an abstract intro to OO example (such as employee payroll) and write it in Moose with full unit test coverage.
  13. Lastly, read the `perlstyle` documentation, and then write your own style guide.

Thanks, Norm. Thorm.