I've been working with Perl long enough that many of its idiosyncracies have become second nature to me. When new programmers join our group, they frequently have little to no experience with Perl, and it's usually my task to train them (to the extent necessary). I'd like to know what to focus on when training a programmer who is new to Perl but has experience with other languages (this question is meant to be language-agnostic, but most developers I've worked with have come from Java).
A few things occur to me:
- The proper use of sigils
- Referencing/Dereferencing
- Use of list functions like map, grep, sort
Is there anything in particular that you've found it useful to focus on when helping a programmer to transition to Perl? Do you stress the similarities or the differences, or both in equal measure?
as others said:
maybe
for Java programmers:
English.pm
Moose/Mouse
Perl::Critic
perltidy
Frankly, I'd just give them the Camel. It's such a readable and entertaining book, they'll be up and running in no time. I'm still laughing about 'Perl holds truth to be self-evident' and it must be ten years since I first read it.
Based on my experience in the workplace I'd recommend beginning with Perl's documentation (already covered here) and spend some time showing the student how to test code on the command line. It's really surprising how quickly someone can pick up a language when they can try something on the fly and make corrections until they get it right.
Another surprising aspect is context. The fact that functions or even variables behave differently depending on whether they're referenced in list or scalar (or void) context has been an important detail for Perl trainees.
I usually insist on "higher-level" built in functions (map, grep, splice, split). Because of TMTOWTDI, many programmers only remember the more familiar aspects of Perl (like the C-style loops, substr and index) and use exclusively those.
After they are familiar with the language, Intermediate Perl and Advanced Perl Programming can give them further insights into the world of Perl
Just joking, but whatever you do, show things like this LAST! ;)
This is a single detail, not a full answer to your question, but for me, the mark of someone who's truly become oriented to Perl is someone who replaces this idiom:
with this idiom:
Teach them lists as lists, not just as arrays. Teach the awesome data structures. Teach lists, hashes, lists of hashes, hashes of lists, hashes of hashes. That's where the biggest step up in power comes in over most conventional strongly-typed languages. (Ironically in the Java shop I joined this year, we sling around tons of arbitarily deep nested HashMap structures. Too many, in fact; I'm the one arguing for doing a bit less of it! But in Perl, this sort of thing is vital.)