Which is the better language to learn Perl or PHP?

Someone who watched my Perl videos asked me if she should learn Perl or PHP? I don't have details about her situation but she is 28 years old and taking exams where she needed Perl and DBI.

The full question was like this:

Which is the better language to learn perl or PHP? Which do you think will benefit me more?

Let me try to answer her on this blog as the answer might be interesting to more people.

I think the answer, as to most questions:

It depends.

It depends on a lot of things.

Would you like to be a programmer or a system administrator? For a system administrator, Perl is much better than PHP, to the point that I don't think anyone uses PHP for system administration. Neither for Linux/Unix not for Windows.

If a programmer, would you like to build mostly web applications or are you interested in back-end automation as well? For example test automation? Configuration management? For the back-end stuff Perl is way better than PHP.

Basically the only area where PHP might provide better career opportunities is the field of web development.

Mind you, that's a huge market, but there are other things as well that might interest you.

It is also important to know if you are an entrepreneur type who might want to set up her own company or an employee type. Would you like to work on your own serving clients, or would you prefer to work in a team in a large company? Maybe you'd like to setup your own start-up? I know this is not clear cut either. People move from being employed in a company to being self-employed or even starting their own dream of becoming a millionaire.

Anyway. Basically in every field, except web development, you'd be better off with Perl.

In the web development field you need to think about other things as well. According to all measurements, in the last 10 years there were a lot more web applications written in PHP than in Perl. There are lot more people working as PHP programmers than Perl programmers.

This of course does not tell us what will happen in the next 10-20 years but that's what we have now.

So for you, who is probably going to look for a job the choice is like this:

Learn PHP. Have a lot more opportunities but have a lot more competition of low salaried employees.


Learn Perl. Have fewer job offers but have a lot less competition for those positions.

In the past few years we have seen a sharp increase in the need for good Perl developers in a number of cities around the world.

Maybe you should to look around where you live and check what kind of job opportunities are in either of those languages. Then check out jobs.perl.org to see if there might be job opportunities that are in a place where you would like to live for a few years.

Of course I simplified. There are more factors to take into account. Even if you only look at the job market.

I hope this help.

Tell me, what do you think? Which do you think will benefit you more? Perl or PHP?