Click to See Complete Forum and Search --> : PHP vs. Pearl


ep2002
09-29-2004, 06:16 PM
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 :)


Michelle

Jeff Mott
09-30-2004, 12:06 AM
Here's a couple articles I dug up for you.

http://php.weblogs.com/php_versus_perl
http://www.serverwatch.com/tutorials/article.php/1126681

One is biased toward PHP. The other is somewhat biased toward Perl, but for the most part split down the middle, I think.

Personally, I prefer Perl.

I like knowing that, when using Perl, there is nothing I can't do.

And in PHP, I hate that you cannot force strict behavior for variable declaration. It has been my experience that strict coding styles protect you from some very easy to make and very hard to find bugs, including the most common: typos.

The two most common arguments against Perl that are, in my opinion, misconceived are:

1. Speed. If speed is truly as issue then neither Perl nor PHP is the answer. You will need a lower-level language, like C for example. When compared with C, the speed difference between Perl and PHP seems barely worth mentioning.

2. Web specific functions. Many articles will show how easy it is to do something in PHP than in Perl. The problem with this is that Perl is a general purpose language, and as such does not have Web specific features built into the language core. These features are accessible instead through modules. With the most useful and well-written ones provided with Perl's standard distribution, which means there is no hassle of installing modules that some people try to claim. The complex Perl code they try to show you is complex because they choose not to use those modules. Or they are simply not competent in Perl to even know that they exist, which would naturally make their opinions about Perl unreliable anyway.

Jona
09-30-2004, 01:11 AM
I completely agree with Jeff. Perl is more powerful and more multi-purpose; PHP is Web-only, but much easier. I personally use PHP more often than Perl because it's quick and easy. There are times, though, when Perl is a better alternative. It mostly depends on what you prefer, and why. I'll admit it, I'm just not very interested in having to type out all the headers and stuff each time; in PHP you just make sure your file extension is right, and start programming. In most cases, they're pretty much the same, aside from basic syntax differences.

NogDog
09-30-2004, 09:15 AM
A bit of disagreement with Jona (first time that's happened): PHP is not web-only. However, that being said, my personal preference is to use PHP for web pages/forms as I find I can be more productive with it than Perl, and Perl for other, non-web tasks for the same reason as well as the fact that Perl is a more general language. However, if I were doing some web project that required some pretty fancy tricks to do what needed doing, I might opt for Perl due to its greater depth of functionality and all the available modules which might already have figured out how to do what I need to do.

For complex text parsing/manipulation, Perl would be my choice over any language.

So I guess that for me I find that neither is necessarily better. I just like to choose the one that I feel will work best for me for the task at hand.

silent11
09-30-2004, 11:27 AM
I really didn't even want to respond to this, but here goes.

Do we really need to discuss this? This has been discussed a gazillion times already all over the internet. The winner will always depend on which YOU like the best. I could give you 10 reasons why python is better than ruby, but if you like ruby, you're going to program in ruby.

But please, please, one favor I ask of you is to get the name right.

LOOK! As I read these responses you read things like "PHP is web-only", etc.. , etc... How do you know what you are reading is true. I can tell you that the above statement isn't.

My point being is that MOST people that like programming in language X only really know 1/2 of the in's and out's of language X. And when it comes to language Y, the language they don't use and know even less about, they don't like simply because the so-called 'hard-core' language X guys aren't supposed like language Y. Also, most people that make statements like above don't really use language Y ( and if they make claims like the one above it's proof that they don't ).

I could go on... but I won't.

Besides, having to defend PHP is most difficult - especially in a thread such as this one.

Every lanuguage has it's strengths, every language has it's weaknesses. A better discussion could be "Perl v. PHP with respect to xyz".

Update: Jona, I mean no disrespect. I just wanted to point out that everything read in forums like this should be researched by the person asking questions before anything is taken to heart.

Jona
09-30-2004, 02:01 PM
Sorry, guys, my mistake; when is PHP not used on the Web? It's always good to get the facts straight. I just assumed. Please forgive me.

silent11
09-30-2004, 02:11 PM
Originally posted by Jona
Sorry, guys, my mistake; when is PHP not used on the Web? It's always good to get the facts straight. I just assumed. Please forgive me.

The PEAR install is a good example. Which I just did a few minutes ago.

http://pear.php.net/

If you are on windows {and php is installed where mine is on my box} you can take a look at a console prgram written in PHP.

C:\PHP\PEAR\go-pear.php

you can kick it off by double-clicking C:\PHP\go-pear.bat

For you all ( yall ) on linux Try this:

lynx -source http://pear.php.net/go-pear | php -q"; echo;

Jona
09-30-2004, 02:17 PM
Ooh, whoa, crap. I should have known! Thanks! :D

ep2002
10-01-2004, 04:55 AM
Okay guys, now that you have finished talking shop LOL

Yes, I was blasted a cpl. of times about my spelling. I am sooo sorry LOL

I'm NOT a programmer & some of you are talking above my knowledge base.

I'll tell you why I'm asking.

I have a programmer that is considering partnering up with me & he said he wanted to do the application I need done in mod_Perl.

I said I wanted PHP b/c that's all the rage & of course I know that Perl is older.

This one is for the backend of a web site, if that helps anyone with advising me.

It will control the front end the customers see plus administrators will use another level in the backend that their customers don't see.

I hope that made sense. :)

Thanks & have a great Friday !



Michelle :)

NogDog
10-01-2004, 09:27 AM
Both PHP and Perl can get the job done no problem. Both are widely used and supported. Both perform well.

If your programmer partner knows Perl well but does not know PHP, you may be risking a number of problems if you force him/her to use PHP, namely longer development time and buggy/inefficient code. In any case, isn't a non-programmer telling a programmer which language to use a bit like me telling my auto mechanic which wrench to use? ;)

silent11
10-01-2004, 11:25 AM
In my opinion, if you expect ALOT of traffic and transaction to take place on your site mod_perl would be a better solution. If you are getting less than a 10,000 (or so) hits a day on one server then PHP should do fine.

Jona
10-01-2004, 01:07 PM
Silent, why would Perl be better if the project gets more hits?

silent11
10-01-2004, 03:01 PM
Originally posted by Jona
Silent, why would Perl be better if the project gets more hits?

I know you're not one for *shop talk* but this article is worth a read.

Experiences of Using PHP in Large Websites (http://www.ukuug.org/events/linux2002/papers/html/php/index.html)

Now for a quote from the last paragraph of the article:


For more experienced developers, though, the language’s simplicity rapidly turns into complexity, slowing down the development process. These developers are the ones who have the skills needed to build large and/or complex websites; using PHP for such sites therefore tends to be a net loss. This tendency is reinforced by PHP’s lack of the linguistic features needed to promote working on large software projects. If your project is at all large or complex, it may be better to look elsewhere when choosing an implementation language.

In cases where PHP has been determined to be inappropriate, what language should be used? There is considerable choice here; few languages are as bad as PHP for doing serious development work. The author and his colleagues have had good results with Perl, and believe that languages such as C++, Java, and Python should serve equally well.





You can read some success stories from companies using mod_perl here (http://perl.apache.org/outstanding/index.html)





Big sites like amazon.com and yahoo.com put out ads for mod_perl developers. I've never seen them put out ads for PHP developers.


http://jobs.perl.org/search?q=Ticketmaster&bin=and

http://jobs.perl.org/search?q=Yahoo&bin=and

http://jobs.perl.org/search?q=Amazon&bin=and







Lastly, my favorite PHP quote of all time:

PHP is training wheels without the bicycle.




Still - even with all this said I will defend the fact that PHP can be the right solution to many problems - it has been for me, personally, many times.

Jona
10-01-2004, 03:32 PM
That's very interesting, Silent. PHP has always seemed more simple and useful for me, even in large-scale projects; I suppose I'm just very familiar with it. The "deficiencies" seem more like features which have often simple work-arounds when they become useless. (For example, the equality [==] operator.) But, then again, it's kind of like the difference between a strict doctype (Perl) and a transitional one (PHP). :p PHP is just a simpler solution, in most cases. I'll have to agree with your statements, and those to which you linked, though.

Jeff Mott
10-02-2004, 02:51 AM
Experiences of Using PHP in Large Websites (http://www.ukuug.org/events/linux2002/papers/html/php/index.html)I think this should be stickied in the PHP forum.

:D :p

Jona
10-02-2004, 02:38 PM
Aww, I'm going to cry now, Jeff. :( lol. Just playing. Let's not try to put me out of a job temporarily, though, all right? :p I'm working on Perl still, but getting there.

drythirst
10-02-2004, 10:26 PM
Jeff Mott:
What does
Originally in Jeff Mott's signature
for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
{for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

mean?
That's what I don't get about Perl..... Too much jibberish

<?php
echo (well that's what it is to me anyways)
?>


I like PHP best, cuz i learned it first, and its easy, considerably fast, goes with DBs, i love it, its all i know besides HTML!!
is html a language? some say it is and some say its not

Paul Jr
10-02-2004, 10:31 PM
Originally posted by drythirst
Jeff Mott:
What does
Originally in Jeff Mott's signature
for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
{for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";
mean?
This was discussed before, and I believe it says, when run, “Just another Perl hacker.” ;)

Originally posted by drythirst
is html a language? some say it is and some say its not
It sure is a language. HyperText Markup Language.

Jona
10-02-2004, 11:26 PM
Originally posted by Paul Jr
This was discussed before, and I believe it says, when run, “Just another Perl hacker.” ;)

Actually it says Just another Perl hacker, (http://cmm.sonoracabinets.com/cgi-bin/jeffmott.pl). ;)

Jeff Mott
10-02-2004, 11:45 PM
That's what I don't get about Perl..... Too much jibberishWell, in this case the code is supposed to look like jibberish. It's a custom where the idea is to write a Perl program in the most obfuscated way possible that prints out "Just another Perl hacker," (yes, the comma too ;)).

Paul Jr
10-04-2004, 10:12 PM
Ahh, missed the comma. :D

Jona
10-05-2004, 12:41 AM
By the way, Jeff, PHP does have strict warnings, but by default they are turned off.

ep2002
10-12-2004, 11:55 AM
Sorry for the delay, but it looks like you guys had a party without me LOL

Now when you say over 10,000 visitors, I will have my customers accessing their DB & their customers accessing the front end which will access the backend. So, does that count as 2 hits? Do you mean 10,000 all at one time, or over the course of a month?

Thanks & I hope your day is going well.


Michelle :)

Scriptage
10-18-2004, 04:48 PM
In my opinion, if you expect ALOT of traffic and transaction to take place on your site mod_perl would be a better solution. If you are getting less than a 10,000 (or so) hits a day on one server then PHP should do fine.

What?
Are you mad?
What has the amount of hits got to do anything with using php? If you read the article it actually says that the problems experienced with using php on larger projects comes from the greater amount of work and the lack of "features":

PHP is nowadays a programming language simplified to the point where the available abstractions and concepts just aren’t sufficient to express the programmer’s intent

As netconcepts.com say:

PHP takes less "overhead" than Perl, meaning that PHP scripts will run faster than CGI scripts written in Perl, and you'll be able to handle more simultaneous users on your site. Benchmarking tests show time and again that PHP runs faster than other web programming languages. Check out these benchmarking (http://www.linuxhq.com/ldp/howto/PHP-HOWTO-9.html) analyses done by major computing magazines.

So Silent you may need to heed your own advice and stop reporting on things that you do not really no alot about.

Regards

chrisranjana
10-19-2004, 06:32 AM
Here is an old thread

http://aspn.activestate.com/ASPN/Mail/Message/php-general/1222030


as posted by Daniel Grace



This all started in a little debate between me and a friend of mine
who I think is as much a PERL zealot as I am a PHP zealot (I was
briefly pondering the idea of a Win32 API extension for PHP), and the
results were rather surprising -- to me, at least..

It all started when I asked him what PERL had that PHP didn't in
terms of language (not taking community, modules, etc. into an
account). We both believed that the two would be very similiar in
speed -- he thought PERL would be a little faster but not enough to
be noticeable. For the first test, I went with a program that
computed prime numbers between 2 and 10000, using no form of caching
or anything like that. I gave him the PHP source with the task of
writing something in PERL as close to the original PHP source as
possible. The results:

(note: I didn't know if PERL had PHP's continue(2), hence why I used
the slightly less efficient method here:)

prime.php:
#!/usr/bin/php -q
<?php

echo "2\n";

for($check = 3 ; $check < 10000 ; $check += 2) {
$prime = 1;
$half = (int) $check / 2;
for($against = 2 ; $against <= $half ; ++$against) {
if(!($check % $against)) {
$prime = 0;
break;
}
}
if($prime) echo "$check\n";
}


prime.pl:
#!/usr/bin/perl
# print "2\n";
my $num;
for ($num = 3; $num < 10000; $num+=2)
{
my $prime = 1;
for $check ( 2 .. int($num/2) )
{
if ($num % $check == 0)
{
$prime = 0;
last;
}
}
# print "$num\n" if $prime;
}


The test machine is an AMD Duron 700 MHz using an a-bit KT7A
motherboard with 256 MB of PC100 SDRAM. uname -a reports "Linux
ulysses.venura.net 2.4.17-ulysses1 #1 Sat Dec 29 14:44:46 PST 2001
i686 unknown", PHP 4.2.1 was configured with
--enable-inline-optimization --prefix=[somepath], PERL 5.6.1 was
configured with -O3 (among other options) (PHP compiles with -g -O2
with no 'easy' (at-configure-time) way to change that, to my
knowledge).

Both programs were ran once normally to verify they actually
generated prime numbers, and then the bash "time" command was used to
time them, piping their output to /dev/null to prevent that from
being a factor. I re-ran the tests a few times with results
consistently similiar to those listed here:

The results:

[dewin@ulysses profiling]$ time ./prime.php /dev/null

real 0m14.465s
user 0m8.610s
sys 0m0.070s

[dewin@ulysses profiling]$ time ./prime.pl /dev/null

real 0m5.302s
user 0m3.180s
sys 0m0.000s



A second system, with PHP compiled the same way and a PERL 5.6.1
binary distributed by Red Hat, 1.2 ghz with 442 MB of RAM:

[root@mrr-016 law]# time ./prime.pl /dev/null
real 0m2.078s
user 0m2.040s
sys 0m0.010s

[root@mrr-016 law]# time ./prime.php /dev/null
real 0m5.512s
user 0m5.430s
sys 0m0.010s


Comments? I was expecting the numbers to be very similiar -- rather
shocked that the PERL ended up being about 2.5x as fast as PHP was.



Ok now this happened way back in 2002 !

ok now lets do the same test in 2004 and post our results here.

Ultimater
02-09-2005, 02:35 AM
Originally posted by drythirst
Jeff Mott:
What does
......
mean?
That's what I don't get about Perl..... Too much jibberish

<?php
echo (well that's what it is to me anyways)
?>


I like PHP best, cuz i learned it first, and its easy, considerably fast, goes with DBs, i love it, its all i know besides HTML!!
is html a language? some say it is and some say its not

You can run it yourself, it just lacks a head statement.
i.e.print "Content-type: text/html\n\n";
Just save this as something.pl

print "Content-type: text/html\n\n";

for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
{
for(ord){
$i+=$_&7;
grep(vec($s,$i++,1)=1,1..($_>>3)-4);
}
}
print"$s\n";