Jump to content

perl vs php


nathanmaxsonadil

What do you use most often?  

39 members have voted

  1. 1. What do you use most often?

    • Perl
      1
    • Php
      38


Recommended Posts

Asking this question on a PHP board will most likely give you some biased answers. I prefer PHP because my knowledge of Perl is very limited.

 

Plus PHP is probaly better because you can do anything and im learning it  8)

1. You can do just as much in Perl as in PHP.

2. Why would it be better because you are learning it? ::)

Link to comment
Share on other sites

I'd just like to point out that the language we use more often and the language we prefer may not be the same. :) I use PHP for nearly everything, but that's simply because it's what I do at work. When I don't have to use PHP, I rarely (never) do. Perl or python would be my scripting language of preference, unless we can count bash scripting.

Link to comment
Share on other sites

Also perl is better used for text processing the web development.

 

I'm not sure how you came to that realization... that's basically all that PHP is, a string and number manipulator. I've been slowly moving my personal web pages to perl, and I'm finding that it's much more powerful than PHP - the only problem I'm having is that my host doesn't have some of the modules installed that I'd like to use.

Link to comment
Share on other sites

I'm finding that it's much more powerful than PHP

How is perl much more powerful than php?  I am not saying it is not becuase i don't know.

 

If you like perl good for you, i find the syntax goes against logic, i wish i could show you some of the perl code i have had to convert.

Link to comment
Share on other sites

The majority of my work is Perl. I had to create a web application when my knowledge of Perl was meager, so I do have a little PHP around.

 

I've been slowly moving my personal web pages to perl

 

How do you feel about Perl's OOP? This is where I can get a little irritated at times, although I have to admit that I haven't done enough or read enough to become more accepting. Do you know if there will be vast improvements in version 6? Also, I haven't used Perl for web development yet, how was the transition for you?

 

If you like perl good for you, i find the syntax goes against logic, i wish i could show you some of the perl code i have had to convert.

 

Actually, the syntax is extremely logical. Code can only be as bad as its author. I've transformed some really crappy scripts into nicely organized machines :)

 

How is perl much more powerful than php?

 

It depends on the usage. Perl can dig through DNA sequences (rather easily, I believe) thanks to its powerful regular expression capabilities. PHP does use PCRE (Perl-Compatible Regular Expressions), but not fully--it can only go so far. For instance, PHP lacks the ability to perform iterative matching and embed code within the pattern.

Link to comment
Share on other sites

I'm finding that it's much more powerful than PHP

How is perl much more powerful than php?

 

Well, for instance, you can "name" loops. In most languages, if you have a multiple-level "for" statement, and you have conditions in the innermost loop that require you to go back to the start of the outermost loop, you have to break out of every loop. With perl, you can just say "next LOOPNAME;" and it goes.

 

And this is minor, but they have an "if not" condition built in. It executes the code inside an 'unless' condition unless the condition is true.

 

#!/usr/bin/perl
$bool = true;
unless($bool)
{
    print "\$bool is not true.";
}

 

Note that this is not a comprehensive list. :)

 

How do you feel about Perl's OOP? This is where I can get a little irritated at times, although I have to admit that I haven't done enough or read enough to become more accepting. Do you know if there will be vast improvements in version 6? Also, I haven't used Perl for web development yet, how was the transition for you?

 

I haven't actually done anything with its OOP functionality, so I don't know anything about it, but I'll give it a shot after I get back from work. To me, it seems like you might use modules as classes, and subs are subs no matter where you go. :) I'm afraid that we may have to wait a while before we see improved object orientation, but I imagine there's a simple reason for that - perl is a scripting language. :) I don't imagine that there is a majority that want or need improved object orientation. And I haven't been keeping an eye on the development of perl 6, but this was pretty informative: http://www.perl.com/pub/a/2007/05/10/everyday-perl-6.html

 

The transition was interesting. Instead of using $_POST and $_GET, you need to break up %ENV{'QUERY_STRING'} into its individual pieces, for example. Installing mod_perl on my workstation was no piece of cake, either, but it just took some trial-and-error to get the httpd configs right. Other than the syntactical differences and differences like the $_POST and $_GET one, you really don't do much differently. Instead of using built-in functions for database access, you use modules, etc.

Link to comment
Share on other sites

I'm afraid that we may have to wait a while before we see improved object orientation, but I imagine there's a simple reason for that - perl is a scripting language. Smiley I don't imagine that there is a majority that want or need improved object orientation.

would you consider PHP a "scripting language" because i would, however i still use classes as much as i can inside PHP.

Link to comment
Share on other sites

Well, PHP is a scripting language also; I think it's a matter of how they were designed. Perl's OOP isn't as bad as I made it out to be--the basics are simple and clever. It's things like cloning nested references that get spooky. Come to think of it, I haven't tried cloning in PHP...

 

P.S. See this topic for more information Liquid.

Link to comment
Share on other sites

i use php more than perl but i find perl better for making websites, because its a challenge trying to code in perl and get everything exactly how you want it.

 

perl is easy from my point of view, because perl is nearly like C++ and i know quite a lot about C++

I think that php is more like C++, well atleast when is comes to classes/OOP

Link to comment
Share on other sites

I'm afraid that we may have to wait a while before we see improved object orientation, but I imagine there's a simple reason for that - perl is a scripting language. Smiley I don't imagine that there is a majority that want or need improved object orientation.

would you consider PHP a "scripting language" because i would, however i still use classes as much as i can inside PHP.

 

Oh, absolutely. But as effigy so wisely put it, it's a matter of design. PHP was designed specifically to allow people to easily create dynamic content on their websites, and to be run on a server, where perl was designed (and is primarily used) for client-side scripting. You don't generally use PHP on the client-side, nor do you generally implement perl in a server-client situation. Sure, it's not uncommon for either situation to occur, but they're not the majority.

 

It's things like cloning nested references that get spooky. Come to think of it, I haven't tried cloning in PHP...

 

Oh, it gets plenty uncomfortable in PHP as well. :) I've had to clone objects quite a few times, when I need multiple identical or almost-identical objects.

Link to comment
Share on other sites

i like php......... because im learning it fast..... but it does not mean..... i dislike perl....... instead.... i haven't yet use perl so far........... heheheh....

 

What's up with the............................. excessive amount of dots (and in...... the middle of sentences too....................................................................)?

Link to comment
Share on other sites

Oh, it gets plenty uncomfortable in PHP as well. :) I've had to clone objects quite a few times, when I need multiple identical or almost-identical objects.

 

Another reason why the magic methods are a blessing:

 

<?php
abstract class Backbone_Data_DomainObject {

/**
 * Clones all aggregate objects. Relies on Backbone_Tools::getAggregateObjectNames,
 * so only public and properly documentated objects are cloned.
 *
 * @uses Backbone_Tools::getAggregateObjectNames
 */
public function __clone(){
	$aggregates = Backbone_Tools::getAggregateObjectNames($this);
	foreach ($aggregates as $propertyName){
		$this->$propertyName = clone $this->$propertyName;
	}
}
?>

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.