Welcome to WebmasterWorld Guest from 54.167.155.147

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Perl or PHP?

Which Is the Best One to Begin with?

   
2:57 am on Nov 30, 2005 (gmt 0)

5+ Year Member



I am a totally new comer for server side scripting
and I want to learn it because of its high functionality.
Which language is best to begin with? Perl or PHP?

Any recomendation for resources to begin with is highly
appreciated.

7:37 am on Nov 30, 2005 (gmt 0)

10+ Year Member



My personal opinion is that it depends on what you will use it for and how much programming you've done in the past.

PHP is an excellent language for embedding code into HTML, and has built-in support for mySQL. However, I wouldn't really advise using it for big programs because the embedded nature makes it hard to maintain control flow etc.

On the other hand, Perl is also excellent, but you have to generate the whole page, not just parts of it (as you do with PHP). It can also be used for other purposes (e.g., server admin, file processing, etc.)

10:13 am on Nov 30, 2005 (gmt 0)

10+ Year Member



I have a smiliar situation with you and finally I decided to learn Perl. I made this decision because I found that Perl is more versatile, flexible and powerful. As a matter of fact, after learned Perl for a while, I found myself automatically familiar with PHP. Anyway, this is my personal experience.
6:35 am on Dec 5, 2005 (gmt 0)

5+ Year Member



Thank you all.
12:37 pm on Dec 8, 2005 (gmt 0)

5+ Year Member



I agree to with simon. But you will find more (simply & small) code samples for PHP. IMHO Perl is not so easy to set up on a server.
12:53 pm on Dec 8, 2005 (gmt 0)

5+ Year Member



Here are some stats about posts on webmasterworld.com:
Perl Server Side CGI Scripting: Post 23,637
PHP Server Side Scripting: Post62,026
1:11 pm on Dec 8, 2005 (gmt 0)

10+ Year Member



IMHO PHP is easier to learn and apply to websites than Perl. However, once you get past the learning curve the it could be that Perl is a bit more versitile.

For myself, I chose PHP 7-years ago because of its ease of use and because I pretty much only do coding for websites.

2:01 pm on Dec 8, 2005 (gmt 0)

10+ Year Member



alexn makes a generally accepted statement about PHP in that it is ok for small projects.

But perl starts to show its versatility when dealing with large systems that span across several, perhaps hundreds of servers.

As a programmer of both, I have to say that perl is the way to go. It does have a higher learning curve than PHP but once you understand the language you can get MUCH more done in less time than the same amount of aptitude in PHP can accomplish.

The amount of posts in the PHP forum doesn't really indicate anything about PHP being better. To me it seems to show that there are more PHP noobs and there are better places to get help with perl *cough*perlmonks*cough (Sorry Brett).

My Two Cents...

5:50 pm on Dec 8, 2005 (gmt 0)

10+ Year Member



I have been codeing in Perl for over 10 years and I have NEVER found anything I can not do on the server with Perl. The learning curve, don't let that scare anybody, it is about the same as any other language. Once you know how to program, learning a language is the easy part.

Programing in general is just logic. If you know how to play chess, you can learn to program with ease.

The way I learned perl was to download other peoples scripts and study them, modify them and build something from them. I did not buy a Perl book for 2-3 years, and only then to reference, have never actually read one.

9:39 am on Dec 13, 2005 (gmt 0)

10+ Year Member



If your sole objective is web application, go Php. Otherwise go Perl.
10:16 am on Dec 13, 2005 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



I dislike PHP in many ways but I use it because:

1) I use a CMS written in PHP and I need to modify/extend it. There are a LOT of PHP CMSes around.

2) It has a huge range of functions and almost anything you can wish for is available.

3) It mixes very nicely with HTML

4) On-line documentation is superb

I dislike it because it is ugly. Function names are inconsistent. It is not really dynamic - for example you can not re-define a function (once a function is defined, you can not change it).

I would never use PHP for anything other than web pages.

Incidentally it is not true that you must create entire web pages in Perl - there is an Apache module that allows you to place fragments of Perl within an HTML page - just like PHP.

I have to say I am not that enamoured either language in-itself, but their popularity gives them an edge (e.g. cheap hosting, lots of libraries available, lots of documentation) over what I would consider better languages in themselves (TCL, Ruby).

4:04 am on Dec 27, 2005 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Can I just say: benchmark, error handling. :)
12:28 am on Dec 28, 2005 (gmt 0)

5+ Year Member



both are good if your going to do a lot of sys admin stuff then perl, especially if its cross platform, is a good choice since there are a lot of prewritten things out there for that.

If you just need a general purpose scripting language that is qucik to learn and don't need prewritten sys admin tools go with php.

When it comes down to it though I can use both equally and prefer php if there isn't something written to do the job already.

3:27 am on Dec 31, 2005 (gmt 0)

10+ Year Member



PHP is faster when you're dealing with basic websites with a database backend. In websites, I use Perl for the heavy lifting like complex SOAP or XML parsing, then feed the results back to PHP for display.

I'm a devotee to PHP for websites but I wouldn't think of using it for difficult server work.

I'd say start with PHP, then as your skill and needs grow, start looking at Perl. Learning PHP before you learn Perl will probably make you a better Perl programmer anyway :-)

9:32 am on Jan 11, 2006 (gmt 0)

5+ Year Member



Basic Perl CGI scripts are inferior to PHP.
I say: For a simple, unknown environment use PHP.

If you can use frame works like HTML::Mason (r0xx0rs ^^ )or HTML::Template use Perl.

When you use Perl you should be able to install any modul form CPAN.

You do not need "build in" support for xyz. You need the rights to install more modules.

Perl mixes nicely with HTML. (embeded)
Perl is fast.
Perl is easy.
Perl connects easily to almost any DB known to mankind.
You can do almost anything with Perl.

BUT:

You need to tune the installation of your Server and Apache. Thanks to the cpan shell this is very easy. But you need the rights to do it. ;)

Or in other words:
If I had to deploy a web-application wich should run on every "out of the box" LAMP system via FTP upload I would use PHP.

THIS was the reason for the great success of PHP. But today root/dedicated servers are cheap.

So use::Perl;

[edited by: Xenon001 at 9:42 am (utc) on Jan. 11, 2006]

9:41 am on Jan 11, 2006 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



and welcome to WebmasterWorld Xenon001
8:19 am on Jan 17, 2006 (gmt 0)

5+ Year Member



I was in your position and I did not know which to start, but due to nature of my work, I finally decided to learn php, because it is easy to learn and there is dozens of easy to flow tutorials in online.