PHP vs. Pearl

Hi all,

Michelle here.

I want to know, objectively, LOL yeh right, who thinks Pearl is better than PHP & why & if it’s just as easy to find a Pearl Programmer than a PHP programmer.

This is for DB applications.

Pls. only respond to this thread if you know PHP & Pearl really well.

Thanks & have a great night :slight_smile:

Michelle

I think you mean Perl, don’t you?

I write Perl and PHP and I like them both. It is just as easy to write DB apps in perl as it is in php. Having done both (and a lot of both), I prefer php. The syntax of perl and php are often so alike it would be hard to tell them apart. But when it comes down to it, if I have to choose, I’ll use php over perl. Though I’m fluent in both.

Take his post and add my name to it as it is exactly what I would have said if I had logged in sooner. (But I probably haven’t used Perl as much). :smiley:

So you like PHP more, but u don’t know why? LOL

Michelle

Not exactly. PHP just “feels” easier to use. PHP seems more efficient when programming for the web (what I do). It seems suited for my needs more. But, I can do everything in perl that I can in php. It’s just a matter of preference, I suppose.

One thing I can say that I like about php is that it has a lot of built in functions that don’t require a module. php has the advantage of being a newer language and learning from older languages, like perl, what functions users need and use.

But I wouldn’t be upset if I had to write something in perl, but if I have a choice it’ll be php.

Hi,
I am a programmer that likes and uses both Perl and PHP. I use PHP for websites and Perl for real programs.

PHP is basically simplified Perl, tailor-made for the Web. Perl is a serious, involved programming language.

For most web apps, PHP really can’t be beat, it’s easy to learn and most Forums/CMS/Blogs and just about everything else is written in PHP. It seems like everyone is learning PHP. PHP is replacing Perl for web apps, but it will never replace Perl for everything, you can write a web program easily in PHP, but you can write a web server easily in Perl.

Web apps is Perl are generally made using mod_perl, an apache module written in C that embeds a Perl interpreter and allows you to write full-fledged apache modules directly in Perl. This isn’t exactly for the faint of heart. But it is an unbeatable way to write serious web apps.

Some facts:
Perl apps using mod_perl are generally as fast or faster than PHP for most things.
PHP was originally written in Perl, as a Perl module.
Perl has a very stable and mature database package called DBI. It provides a database-independant interface.
PHP is missing many features that are considerd vital in a serious language.
PHP’s deliberate lack of advanced features, and the web features that are included in the core language make it very easy to learn and use. You don’t even need to be a programmer to use PHP.
Perl is not harder to read than PHP. In fact, superficially the languages look almost identical.

But if you want to know which is better to use, I say PHP is a better choice for most web apps. If you need something very complex, or something that must do programming tasks that are generally beyond the scope of web apps, use Perl;

If you think you’ll ever need to use the code outside of a web app, use Perl. But basically it’s stupid to ask which is better. PHP is good because lots of web designers know it. Perl is good because it is a seasoned, serious application language. They used it for the Human Genome project fer crissakes.

You can’t judge a language on it’s syntax, but on it’s programming features. You must understand that a programming feature is merely a design pattern that’s built in to the language.

But if you do use Perl, use mod_perl, not CGI. Perl loses out to PHP basically because of the way they interface with Apache. PHP documents just work. But you can’t use Perl without using inefficient CGI, or writing an actual Apache module.

Perl is not harder to read than PHP. In fact, superficially the languages look almost identical.

Sorry i disagree with you there. Perl is a good language yes, but easier to read then PHP no. Ive looked at many Perl and PHP scripts even if both are documented more than 90% of the time ill understand the PHP one better then a Perl one. Mainly because a greater majority of Perl scripts are spaghetti. PHP can be the same but its not entirely misleading best example is an Array in Perl and Hashes. If you had a quick glance of the code, i doubt anyone would pick it up unless they studied it carefully.

That depends on the programmer, not the language. Almost all my php and perl code are nearly identical with a few minor syntax differences. Sure, there are a few spots that vary pretty widely, but for the most part they are strikingly similar - depending on who’s doing the writing.

Exactly.

It’s entirely up to the programmer to write good code. The only reason I can think of that would explain the Perl you’ve seen being ugly is that Perl requires more skill to use properly for some tasks, and whoever wrote that code didn’t know what they were doing.

But if you do use Perl, use mod_perl, not CGI. Perl loses out to PHP basically because of the way they interface with Apache. PHP documents just work. But you can’t use Perl without using inefficient CGI, or writing an actual Apache module.

You can use mod_perl’s Apache::Registry to run CGI scripts virtually unmodified so long as you ‘use strict’. This allows them to perform as well as PHP scripts running under mod_php. Please compare Apples with Apples, ie. Perl CGI (common) with PHP CGI (rare), or mod_perl (less common) with mod_php (very common).

Well, my point is that you still have to do a bit of setup even with Apache::Registry, and that prevents a major barrier to a lot of people that PHP doesn’t.

Okay first off it’s a good thing I’m a grounded secure person. Telling someone their question is stupid is not mature IMO.

There is no such thing as a stupid question. People are on this earth to learn & that’s what these forums are for.

This first DB will work in conjunction with web sites, so I assume that this is what you guys call a web application.

What about if the application is to be on the customer’s computer, not connected to the net? That doesn’t necessarily mean it’s a a much larger application does it?

Eventually there will be 2 applications developed & I wasn’t going to connect the 2nd one to the net, but depending on the feedback I get from programmers, I might.

It’s to keep my customer’s customer’s phone numbers, address, detailed notes etc., when they use their service, that is logged & the contractor is then paid, so it’s got a slight payroll aspect to it, but it’s not major. I may want it to be more automated so it’s like a call centre, but only 1-2 people will be using the application at any one given time.

Thanks & I hope I explained it well enough

Michelle

Doesn’t Perl have a few more datatypes at its disposal? If there are more options for the programmer for certain things then there is reason for a programmer to use that language over another.

I use Python sometimes because I need certain things that PHP can’t accomplish or that it can’t accomplish well.

Exactly. You wouldn’t use a hammer instead of of a wrench to take off a bolt. You can do it, but you shouldn’t :wink:

The bottom line is, use the right tool for the right job. I use perl and php all the time, and like Hartmann, I also use a bit of python now and then and today I had to crank out some shell script. Now and again I throw in a dash of vb for good measure.

Michelle, saying it’s “stupid to ask which is better” is pretty harsh. I think it would have been better to say, It’s not fair to compare two languages. It’s not exacly the same thing. While they are enough similarties that you could probably learn both languages at the same time, I think it comes down to what your doing with them. From your description though, perl and php both are out of the question. For a non-web application you should use a compiled language like C# or one of it’s cousins, or even VB. PHP can be used in windows applications using GTK, but there better ways. If your wanting to program for a pc or mac, then you need to learn a language best suited for that. If your looking for a “jack of all trades” language there really isn’t one.

I’ve never programmed a real web app in Perl. I’ve mostly programmed Windows desktop programs with Perl. But I also use it often for various systems admistration tasks.

I’m just saying that though Perl requires an interpreter program to be present, it’s still a valid general-purpose language.

A Perl app has the same limitations that any language has when using cross-platform toolkits, your windows may not look exactly like normal windows, it may have slightly different buttons and menus, but other than that there are no limitations.

I was curious about this quote:

PHP is missing many features that are considerd vital in a serious language.

What features would those be?

Namespaces, closures, support for modules/components, lexical scoping and dynamic scoping to name a few.

It’s bad that one of the main data types, the “array” is actually a push-hash. (A hash with automatic keys)

Eval is also broken. A high level language needs an efficient and reliable eval construct.

It also needs something more to encourage bottom-up design, if you ask me. File includes as program structure are bad news.

I hate that it does not offer real pointers. It makes some tasks a lot more difficult

I have used Perl for a long time for web applications and command line programs. I resisted PHP terribly, but I am finding that all my new sites I do in PHP. I picked PHP because I think it is better for a few reasons:

  1. There is a huge community of php enthusiasts. On almost any forum you go to, topics in the PHP board will outnumber those in the perl board.

  2. It is a lot cheaper and easier to hire a program to update parts of my code if it is written in PHP, which is the main reason why I picked it (along with the next one).

  3. PHP is so simple that even designers can understand

  4. There is not 1,000 ways to do something. Tons of ways to do something and VERY flexible syntax is great if I am the only way to see my code. Since I am not, I think consistency is best.

Also, for DB applications I have found that PHP is far superior. This is because the DB module in perl has a lot of overhead to it (there are other modules though, if you want). I wrote a command line program in both PHP and PERL (non obfuscated perl programs can be ported over to PHP very quickly and vice-versa. I ported the admin section of oscommerce to PERL in about 5 nights and this was when I did not know PHP very well at all (os commerce was the first program I worked with in PHP)) and PHP outperformed PERL by a significant percent (don’t remember off the top of my head).

Just to be clear :slight_smile: I’m not a programmer. I’m a bizwoman looking for the programmer to do the work & I want to know what is best for my application.

I believe after reading everything, that PHP is the best. It’s a Web Site based application.

Thanks :slight_smile: & Happy Halloween

Michelle