The Path to Mastery (2000)
perlmonks.org
perlmonks.org
I found the same thing to apply in UNIX. The folks who opened all the doors and learned all the details (beyond what class asked) were the ones who could later write 2 or 3 line scripts to solve most any problem.
However the advice about knowing your tools applies to proofs, programming, cooking, mechanical engineering...
A few things in Perl that really don't help:
- Variables don't have to be declared and are global unless specified otherwise. You can 'use strict' to turn off this "feature".
- Strange syntax for working nested structures. Basically nested structures are a hack because Perl <= 4 didn't support them. Hashtables only support scalar values so to put an array in a hashtable you need to store a reference. Dereferencing has rather strange syntax if you're not used to it; even if you're used to it it's still easy to get confused. @{$foo{bar}->baz}...
- OOP feels like a hack because, as you guessed it, earlier Perl versions didn't support it. You have modules; this works as expected. Classes are implemented on top of modules: to instantiate an object, you make a hash, array or scalar value, and "bless" it with a package name, which is like assigning a type to the thing. The thing that was blessed is your instance, and you store your instance variables in it. You then return a reference to that thing and that is your object. The whole syntax is nuts.
- Even function arguments feel like a hack. That's because there is no syntax for them. Every function has an arguments array, called @_. That's not a smiley, that's the actual variable. To get your arguments, you have to extract them from @_, so every function would start off like: my ($arg1, $arg2, $arg3) = @_;
- Threads... oh you mean usable threads? Forget about it. Threads in Perl do not share state by default. You have to explicitly mark variables as 'shared'. If your app is well-architected (not relying a lot on global variables), this isn't much of a problem, but unfortunately Perl also copies all AST nodes upon thread creation. If you have a moderately sized program, like mine (eats 25 MB of RAM) then it 5 years ago it took 15 seconds to create a thread while Perl is making a copy of all the AST nodes. Yikes.
Perl works great as a sed replacement, but for anything larger than, say, 50 lines I would recommend Ruby over Perl. Like Perl, Ruby has builtin regex support.