It's all about using the right tool for the job.
For batch processing, Perl is often a great tool. Get the data, swizzle it about, spit it out, send a notification to someone. That kind of stuff is bread-n-butter, that's what Perl was originally designed to do.
It helps that I have the right mindset. Before I found out about Perl some time in 1994 or 1995, I was using Bourne shell scripts with sed and awk. That could be fun but
- lots of braindead vendor limitations and incompatibilities
- Sometimes you had to use
nawk
instead ofawk
, sometimes you could expect to see a GNU version (gawk
). Different versions of the Bourne shell handled functions differently. And so on... - terrible error handling
- When a tool like awk or sed failed, you were liable to get a minimal message written to standard out. It was hard to persuade shell scripts to halt when there was a problem: by default, they would just sail on regardless. And again, you couldn't rely on things to work across different versions of Unix.
- lack of documentation
- All you had, usually, was the man page. This would devote inordinate amounts of verbiage on the command line usage of a tool like awk, with hardly anything for the language itself. There were O'Reilly books, but they were hard to get and often superficial themselves.
It really helped that Perl 5 came out before I had to learn too much of Perl 4. The first real programming language I learned was Modula 2, so Perl 5 modules felt natural to me. The OO stuff, at least at the start, was mostly syntactic sugar for me...
Many years later, I can still write idiomatic Perl. For a language that is so disdained as write-only and line noise, it feels remarkably natural. Maybe I would be an APL fan if I were of a different generation. Perl, though, has a distinctly practical edge: I use it to get stuff done quickly. It's true that it's my first choice when I have data that isn't quite what I want: sometimes it's just doing what I would do in a text editor if it wasn't too much keyboarding. It sure beats m4.
Now Perl 6 is on the horizon, I may have to go back to the books and learn some more. From what I read, it looks like they're addressing some of the shortcomings that Perl 5 does have. The object model is a bit ugly and a bit fragile too. For simple stuff, not such a problem, but, after all, I want to be able to use Perl comfortably in the large too.
In the mean time, as someone wrote over on Hani's comments:
for real, java vs perl arguments are such bs, I can't believe that people don't find occasion to use both in tandem all of the time