by elchief · 11y ago · 0 comments
OpenBSD is 40% perl. Postgres uses perl for its builds. Perl seems to have better text processing capabilities. But it seems to be dying out compared to python.
Perl often fits in better with the 'advanced shell scripting' type of work than Python or Ruby. It has more libraries for unix-like admin tasks, but less common support for external APIs (which more commonly support Java/Ruby/Python/etc.) so it may be an uphill battle if you use a _lot_ of external APIs.
Perl won't ever 'die out', especially if you write good perl that doesn't depend on flashy popularity-train things. It's far too ingrained in many unix derivatives.
If you're a server admin, you're missing out if you don't know perl. Choosing perl might be a little less common today, but it's totally reasonable if you want it.
Yesterday, there were an even 60 CPAN module releases, and that is a pretty typical day. Most of them weren't NEW modules, but some were.
It's true that you don't as often see Perl APIs released along with the various 'external API' things, but, as someone who probably spends too much time tracking the various new hot things, Perl API support is first rate. It's damn rare that I don't see a Perl API for something, even if it's relatively new.
I'be been watching CPAN for a long, long time, and I will say that it's more vibrant and active now than I have ever seen it.
I don't have an off-the-cuff rec for a python book, but Modern Perl (2014) by chromatic is available online, isn't very long, and should give you a chance to test the waters and decide if that's the way you'd like to go.
I lean more towards Python these days because of tools like SaltStack and Ansible and great library support, and because it fits my brain better.
So with Linux, I'd probably recommend Python as it is a key part of most distros (like Perl still is too, but eg Ruby isn't). But on OpenBSD Python isn't a key builtin part of the OS while Perl is, so I'd still recommend Perl for an OpenBSD admin.
I do mainly Python / Django stuff these days, but if I have some syadmin type tasks, I will happily switch to Perl. It has better build in syntax for quick stuff, like renaming a bunch of files. Built in regexes are so much easier than farting about with object based regexes. Text processing is better. Stuff like file gobbing is built into the language.
Its easier to shoot yourself in the foot with Perl, so I'll choose Python for stuff that is more long term. It really depends what you want to do.
That said, it's not clear what you mean by "picking Perl". Adopting Perl 5 is a distinctly different choice than adopting Perl 6. Considering them as separate languages may be a useful, even if dubious, abstraction.
For Puppet, Chef and other stuff it's Ruby. Python ate most of it's share in biogenetic. Php took over Perl in web dev.
Python is much more readable in general imo.
Plus whoever taking over your script may have to maintain it and they're most likely to know Python than Perl (if you're looking at language popularity). The counter argument is that any good programmer can pick up languages but there is a down time still.