views:

699

answers:

14

Possible Duplicates:
Should I learn Perl, and why?
When should I use Perl CGI instead of PHP (or vice versa)?

Background

I'm currently working as a web developer and have knowledge of HTML, CSS, PHP, MySQL, JavaScript (mainly through jQuery) and Ajax.

I recently entered into the world of Flash and ActionScript and came across some Perl, which was controlling a scoreboard system by editing a text file.

My colleague has also used Perl to write a script to backup our MySQL databases every day and store them online. He has moved on and I have been tasked to maintain the script. As such, I will need to learn Perl.

Question

As a web developer, using the above languages and techniques, would Perl be a useful addition to my proverbial toolbox, or is there a more appropriate language to learn that would be more beneficial?

If Perl is for me, what would you suggest are good resources, I would normally used online resources to learn, but are there any particularly beneficial books?

+13  A: 

The rise of Moose, Catalyst and DBIx::Class make now a great time to get into Perl.

David Dorward
Unfortunately the rise of object oriented Perl packages gave birth to a type of Perl programmer that looked down on other developers who used Perl in hybrid fashion. It wasn't until we could prove that the object-oriented nature of the URL package had a significant impact on performance on a large-scale web site that some of the die-hard OO fans began to realise there was more to life than ideals.
PP
+7  A: 

You should learn anything new if you think it will help you for your projects or work. Even if you only touch a small part of Perl, it will probably help you become better. I'm not saying that you should learn everything out there, but learning is good. It's much more rewarding than watching TV :)

tzup
+8  A: 

Yes, everyone should learn Perl.

Will Perl directly affect your job as a web developer? Probably not. Is Perl the ideal language for web applications? Probably not. And I say this as a professional Perl developer.

Knowing Perl is like knowing Spanish or boyscout knots. No one can say for sure that you will/won't use it, but it's always nice to have in your arsenal. So many scripts are written in Perl. Maybe you will switch jobs and go to a shop whose frameworks are written in Perl. Maybe you need something automated or something scripted. All of these situations are easily addressed if you knew Perl, but you might not have known that if you didn't know Perl.

Perl is the gooey substance that smooths over the otherwise rough in-betweens of computer systems, especially the Internet. Knowing Perl will absolutely make you a better developer, given its expressive power and convenience. Who knows, you may end up liking it.

Perl is far from useless. Even dipping your feet into it will yield a lot of benefit, just because Perl is like that (convenient, powerful, etc).

Mark Canlas
+15  A: 

Perl is worth learning. It is keeping up with the latest buzz words, except for the fact that they are not getting much publicity outside the Perl community. For example, the Catalyst Web Framework is keeping up its pace among the other web frameworks available. It has the added advantage that Perl modules from CPAN can be used. Personally, I have been using Catalyst for a while, and I like it very much.

For learning Perl, there are lots of online resources. Here are a few:

Learning Perl is a good book to start.

Alan Haggai Alavi
+2  A: 

You just can't beat perl when it comes to maintenance scripts, and with the small familiarity's it shares with Php (Php was heavily inspired by perl in its infancy) shouldn't be awkward to learn.

A no-brainer, if you're serious about web developing, my opinion (if only for the maintenance part).

Berzemus
+2  A: 

Perl is just another tool to do a job. If you need to understand someone's perl script you'll obviously need to learn it.

Other than that it is hard to say if you need it as a web developer as there are so many tool choices for web development. Perl has so many uses and web development is just one. The decision to use it is subjective if there is no actual need for it.

Personally I wouldn't spread myself too thin trying to learn every possible web development tool, though a rough knowledge of Perl scripts can be handy especially on unix as you'll come across them outside of plain web development.

tjmoore
+3  A: 

no.

Sort of kidding - indeed you should - but IMHO, you should not give it any priority. The answer is simple: Perl is low in web usage nowadays due to a motive: its (very) rich syntax and many ways to express something make Perl applications really hard to maintain. That means, even hard to read one's self code after a while.

So, for production of long term maintainable apps you should focus on a language that does the same: look forward maintainable apps. My personal preference is Python, which explicitly says on its tenets "Readability Counts". It does sport a rich library environment, like Perl, and is expressive enough to allow you any text transforms or tricks that one can perform in an enigmatic Perl expression in 2 or three very readable lines of code.

I don want to flamebait here, feel free to change "Python" above for any language that prioritizes concision while keeping readability.

That said, now the motives for Perl: there is a lot of legacy code that you could benefit frombeing able to read and re-use. It is fun to hack the in-line text transformation tricks, so that your code appear to be magic. And the way of thinking in Perl can add to your code skills and ideas even for production in other languages.

So, learn HTML, CSS, JavaScript, then a production language for your apps: Python, PHP, Ruby, Java, etc... then as a second (third, fourth, ) language learn Perl to be able to develop some tricks and "learn with the past"

jsbueno
Maintainability is much more a function of the programmer than the language. I have Perl code from 2001 that's perfectly readable to me today - and this is a moderately complex web app, not some toy problem. Conversely, there are people out there who write spaghetti code in Python. Perl *does* have a bad history of poorly-written but well-publicized code, no argument there, but this is the fault of the people who wrote the code, not the fault of Perl.
Dave Sherohman
@Dave: The resemblance to the current state of PHP is remarkable :)
jensgram
+14  A: 

I tried to learn Japanese once. I'd long had a fascination with the culture, and I thought it'd be cool to speak the language. After six weeks on a beginners course at my university, it dawned on me that without a practical day-to-day need to speak the language, I was never going to remember what I'd been taught or develop any real skill with it. Learning for the sake of learning is seldom a useful endeavour. We learn best by doing. We do things because there is a need to do them.

It sounds like you have a practical need of "some" Perl in order to improve this database backup script. I'd wager that with your existing background, a copy of O'Reilly's Perl in a Nutshell, and a couple of free afternoons you could work out what it's doing and how to improve it. If you like how Perl feels after that, start solving some of your other problems using Perl. Using it a little each day is the surest way to learning it. It'll take time though - don't be surprised if your still discovering "new" ways to do things years later.

As for the question of "Is Perl useful?". Plenty of people use it - I'm writing this from a Bioinformatics lab where Perl is the language of choice for crunching through mountains of genetic data, and building web based visualisations of the results.

Your question brought to mind one of Joel's pieces on learning new skills, which is worth a read if you've not seen it before: http://www.joelonsoftware.com/articles/LordPalmerston.html

rob
I'd agree, however it made my visit to Japan a decade later much more interesting. Plus Japanese people respond very positively if you make a (failed) attempt to communicate in their own language. I frequently hear Americans complain the Japanese aren't very friendly; well no, not when you just talk louder to them in English...
PP
A: 

I have great respect for Perl, and think it's a useful tool and a good language to learn. Still, I would like to add my perspective: I have been a web developer for seven years, with real server administation tasks as well (even though far from calling myself a Linux expert or administrator) I do not speak Perl and I have never needed it. By that I mean, I have never been unable to complete a task - be it in development or maintenance - because of my lack of knowledge of Perl.

So if you are feeling pressured into learning a new language that you don't really want to but feel you have to in order to be complete in your field of work, I would say: No, it's not necessary.

Whether it's generally a useful addition to every web developer's toolbox? Why, absolutely. I want to get the hang of it myself one day.

Pekka
A: 

I would consider Python instead. Its easy to learn and has a huge standard library. Its also supported in Google App Engine. Python is also a good "learning" language because of its clean and readable code.

Martin Hoegh
And some Perl programmers came along...
Martin Hoegh
A: 

I had to dabble in Perl when I started my current job in 2007, to maintain a stats system. It was an insight but not a language I would prioritize. If you have to perform maintenance as part of your day job - you've nothing to lose. You're getting paid to do it.

There were minor differences in Perl I've not seen in other languages (list context). Some features like inline regex's (similar to Actionscript / JS) were more pleasant (terse) than PHP's approach. On the flip side, some things felt like a cludge, for example passing array arguments by reference so it can be modified in your subroutine.

I'd have to agree with jsbueno though, for me, Perl has too many ways to accomplish the same task. Revisiting your own code, let alone inheriting another developers can have you scratching your head for a bit while you acclimatize to their style. Python has more appeal for the same reasons jsbueno cited.

Greg K
dereferencing -- do you mean "taking a reference to"? Dereferencing is getting the array back from the reference.
Sean McMillan
Yes sorry, have updated.
Greg K
Looking at other 'should I learn X?' questions on here - they all seems to lean the same way, if your answer doesn't lean towards yes it's not positively ranked.
Greg K
A: 

why not?

the only answer i have for that question: i don't have the time. if you are searching for a new language to learn, to broaden your knowledge, i have three suggestions, both being more suitable in my point of view:

  1. Ruby - I have only superficial knowledge of Perl, but based on the comparisons I can make, I'd say Ruby is a much more radical, flexible and magic language. It promotes object orientation unlike any other language I've ever really used (that said, you might wanna learn smalltalk. at least that's my plan for the foreseable future). There's a really cool introduction to the language >here< (you really might wanna read the foreword). Except funky syntax, Perl has little to offer, Ruby has not, yet Ruby on Rails is probably one of the most productive server frameworks.
  2. haXe - looking at what you've done so far, this should be your weapon of choice. I could explain in detail, but I'd really recommend you, to just give it a shot. If you really want to have some reasons to use it, you should have a look >here&lt;. The only reason I can give you is, is that haXe has been designed to be an expressive and efficient language, and it's creators and maintainers are all people, who use it a lot and drive it forward at an amazing pace. All of the reasons given, why haXe is so great, may seem irrelevant, but you will really thank yourself, if you learn the language. It took me 2-3 months to get comfortable with it (i'm coming from an actionscript background), but now I wouldn't switch even for money.
  3. go - probably the main reason: it is backed by a giant. And if a company like google creates a language, I am lead to believe, that it is very much suitable for serverside developement. This one is definitely on my list.

greetz

back2dos

back2dos
Perl has many great things to offer the average user in addition to the "funky syntax." Just see any of the other answers here.
Robert P
i sense a little bias there. i always find it a little sad, when people don't seem to be able with critisizm of one of their primary languages (which according to your stackoverflow account seems to be perl). 1. I said Perl has little to offer in comparison to Ruby. No other post didn't even make this comparison. 2. Could you point out one post, or one great feature, just so i know? If there is one, i'd like to know myself, but until now, i haven't found any.
back2dos
I have to admit, I'm pretty sick of people saying "I don't know Perl, but Ruby is better." At least you didn't follow it up with a laundry list of incorrect comparisons.
Sean McMillan
A: 

Yes, you should learn Perl, for one reason: mod_perl. mod_perl exposes the entire apache API to perl, letting you do crazy things at any level of apache's internals. If you really want control over what is happening on the web server, your options are mod_perl, or coding directly in C. No other web technology really compares.

If you don't really want to get that close to the web server, then the answer is still yes, but a much more reserved yes; You should learn as many languages as you can so that you can work in any environment. The key to web development is understanding the base web technologies: HTTP, HTML, CSS, and Javascript. Which language you generate your output in is almost meaningless. So learn Perl; Also learn Python, Ruby, Visual Basic.Net, C#, Classic ASP, Java...

Sean McMillan
A: 

I'd learn either Python or Perl; at least one of them will come in handy in your career. If you have need of Perl, it's a pretty quick choice then.

Were I choosing without any project-based bias, my personal choice would be Python; it's easier, for me.

Perl will serve you well. Learn away. :-)

Dean J