Welcome to WebmasterWorld Guest from 54.226.175.101

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Why do so many avoid Perl?

I used to, now I kind of like it!

     
6:50 am on Aug 5, 2015 (gmt 0)

System Operator from US 

incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 25, 2005
posts:14664
votes: 99


I'm just curious why the masses use PHP over PERL because overall PHP is a nasty language with lots of quirks, poorly thought out libraries, and it's slower than Penguin snot on a south pole winter morning.

I firmly believe if WordPress was written in Perl that PHP wouldn't be nearly as popular as it's that app and a few others driving it's usage, not it's blazing fast speed.

I'm thinking the lack of type checking and function prototypes is what slows down Perl's usage because, much like C, Perl doesn't tell you when you've messed up passing bad parameters unless the programming writing the function or classes being called were nice enough to kick out improper parameters being passed.

FWIW, I'm not sure why Python isn't the dominant web language as it precompiles the code to run even faster.

I'm thinking one mission critical program, WordPress, and maybe a couple of carts, is the driving force behind PHP and if someone were to recreate something similar, which could be much faster and more powerful in Perl thanks to it's multi-tasking capabilities and other stuff, that Perl could unseat it.

Probably too late, probably a lost cause, but the more I use Perl, the more I want to use it but the masses have all gone another direction because they're clearly incapable of dealing with a real programming language, the same reason they made Java so those that couldn't hack it writing C and C++ could write software.

Anyone else have any insights into why an obviously inferior dog slow pile of... code ... dominates?

I don't get it.
8:33 pm on Aug 5, 2015 (gmt 0)

Senior Member from GB 

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

joined:Aug 13, 2003
posts: 1053
votes: 3


PHP for simplicity. People start by learning HTML and CSS so putting a couple of PHP lines into that feels comfortable.

The speed issue will not be known to those people. If you only use one language, you have no comparison.

Python is a language I've never used. I just checked my webhost, expecting them not to support it... but they do! I'm sure when I signed up with the host many years back, the choice was PHP or Perl only. Perhaps that is why people don't choose it. It may limit their ability to change host.
8:53 pm on Aug 5, 2015 (gmt 0)

Senior Member

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

joined:Sept 25, 2005
posts:2060
votes: 351


+1 for mixing HTML and PHP, and I'd argue that WordPress is popular because it's written in PHP, not the other way around. WordPress would not have been as accessible to its millions of users today if it had been written in Perl. Also, speed is not an issue unless you're writing very bulky software like WordPress, and opcode caches can take care of precompilation. It may have its faults, but PHP is a great language for the Web.
7:12 am on Aug 7, 2015 (gmt 0)

Preferred Member from AU 

10+ Year Member Top Contributors Of The Month

joined:May 27, 2005
posts:442
votes: 7


Anyone else have any insights into why an obviously inferior dog slow pile of... code ... dominates?


PHP is easy. Perl is not.

I started using PHP only a few months ago and have already written a complex CMS. Before then I always used Classic ASP. But I have simple Perl scripts written by partners that I have not been able to fathom for more than 10 years.

PHP was easy to learn because its straightforward like Classic ASP. But the biggest plus has to be the fact that PHP will run on any Apache web site without any fuss. Perl on the other hand needs TLC.
7:44 pm on Aug 8, 2015 (gmt 0)

System Operator from US 

incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 25, 2005
posts:14664
votes: 99


PHP is easy. Perl is not.


That's inaccurate.

I write both, now that I'm immersed in Perl some things are easier.

From the standpoint of a programmer that has written in upwards of 20 programming languages, I didn't find PHP that easy, not because of the script, but because of it's incongruous library with functions that are close to others but miss simple things which make it a real PITA and it's overall design appears to be haphazard at times due to the nature of it's creation.

While Perl has some of the same issues, I find the documentation is what makes Perl more obtuse than the language itself and the examples sorely lacking, usually lacking the discussion and exchange of samples.

Here's some code:

$var = "some string";
$val = 1;

if( $val ) {
foo($var);
}



Is that PHP or PERL?

If the premise that PHP is easier to write then PERL then this must be PHP, right?

For the most part, you could write Perl that looks like PHP, there's no stopping anyone.

That's the big LIE around PHP being simpler, it's just that hard core programmers like the goodies in PERL and use them which is why it's not easier for new programmers to pick it up because they might as well be looking at C or assembler, it's too low level if the programmer wants it to be.

Here's the first tell of PHP vs Perl, the definition of the function:

sub foo {
my ($var) = @_;
... some code
};


vs. the slightly friendlier but less flexible:

function foo ($var)
... some code
};


Which puts the onus of validating the variables passed to the function on the person writing the function, not the compiler, which was an example of some of the same problem of C which drove people to make Java.

However, other that passing variables and that little issue with arrays vs. references to arrays, you can easily write Perl to look pretty much like PHP, but people opt not to do it which is why newcomers are left scratching their heads.

Again, I'm going to stick with my original theorem regarding the mission critical app driving the adoption as it's happened in other cases as well. Back when MSDOS was battling CP/M for supremacy it was apps like Visicalc and Lotus 1-2-3 that shifted the balance of power, later Excel and Word did the same as the competition quite frankly sucked and crashed.

People go with apps that make their lives easier, to get the job done, they don't care about the language and if something bigger, faster, more powerful came along that made WordPress look like a tinker toy, I think that whatever language it was written in would suddenly see a vast increase in popularity.

History would back up my premise, now who's going to write the app to prove my point? :)
4:04 pm on Aug 14, 2015 (gmt 0)

New User

joined:July 6, 2014
posts: 32
votes: 0


well, the number of (probably cheap) host that support PHP is more than those that support PERL,,,
4:57 pm on Aug 14, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:9235
votes: 780


A host worth its salt has both, and Python, too!

I can get more done with less code in Perl than I can in PHP... with fewer errors ... then again, I'm also not the guy to write the killer app to unseat some other killer app. :)

I have WORK to do!

Perl serves me well and has since 1997.

It has been nicknamed "the Swiss Army chainsaw of scripting languages" because of its flexibility and power,[14] and possibly also because of its "ugliness".[15] In 1998, it was also referred to as the "duct tape that holds the Internet together", in reference to both its ubiquitous use as a glue language and its perceived inelegance.[16]

[en.wikipedia.org...]
7:36 am on Aug 15, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 10, 2001
posts:1551
votes: 10


PHP was the first "language" available to the great masses that offered a tight integration into the web server and a trivial database interface, without requiring a compiler.

Since then, "everybody" uses it, because ... everybody else is using it.

Those few who don't just follow the herd, but actually put some thought into the tools they use, will usually move away from it rather quickly and end up with Python or one of the other more mature languages.

I don't see the attraction of Perl over PHP, as the two are really just variations on the same error-prone design. In fact, PHP was not originally meant to be a separate language, but started as a web toolkit for Perl. Today, it is something of a "simplified Perl", until very recently without even a formal language specification.
12:46 am on Aug 16, 2015 (gmt 0)

Preferred Member from AU 

10+ Year Member Top Contributors Of The Month

joined:May 27, 2005
posts:442
votes: 7


That's inaccurate.


Who are you trying to kid? I wouldn't even waste my time comparing the two in ease of learning. Try from scratch and you might understand the huge difference. Also, PHP is extremely well documented and these days has inbuilt functions for almost anything that one can desire.
5:51 am on Oct 17, 2015 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts:2870
votes: 159


Also, people seem to do things the wrong way and choose their host and then their platform. You have a good choice of hosts for any reasonably widely used language (Python, Ruby, JVM), and given how cheap VPSs are you can really use anything you like at low cost.

I use PHP when something will work pretty much out of the box (e.g. Wordpress for blogs), for anything needing actual development I use Python (more flexible than Perl and very nice to work with) although there are other good choices (Ruby, Scala, etc.) and I am learning other languages.
6:17 am on Oct 17, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:9235
votes: 780


I play in all... but Perl is my love. It just does what needs be done.

That "hard to learn" is a pile of farmer's friend.

It is time to get back to server side interaction and not reliance on third party.
12:54 pm on Oct 19, 2015 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts:2870
votes: 159


It is not really a matter of Perl vs PHP though, it is more

1) PHP vs everything else
2) PERL vs all the other options.

PHP vs everything else is easy: lots of people know it, there are lots of solutions that need minimal customisation (like Wordpress), and every web host supports it. It is the fast and cheap alternative (not just cost of hosting, but cost and availability of developers and the range of off the shelf software which means you need less custom development and what you need is cheaper).

PERL vs all the other options: What advantage does it offer over Python or Ruby? What about all the other languages out there?
3:23 pm on Oct 19, 2015 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4982
votes: 42


Don't know Perl but would probably learn Python before it. Done a bit of C/C++ for things that require more memory management and performance. It's amazing to see performance differences over trivial things like for($i = 0;$i < 100000000;$i++) ;

NodeJS is something the cool kids are also using nowadays, but performance wise I don't think it rates that highly.
8:33 am on Oct 26, 2015 (gmt 0)

Senior Member

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

joined:Mar 30, 2006
posts:1574
votes: 119


Why not so popular? misconceptions. See, most times a thread about "why not Perl" is opened, a lot of space is wasted on people correcting wrong ideas about it than actually expanding the benefits (that's very different). There is much force on talking about many untested "wrongs".

I've worked on PHP and Perl, like it so much that when I had to choose a language to build my own CMS I went PERL all the way on 4 diff versions (of the CMS), then stopped and created my own framework (there are bits of discussion on at least two threads). I enjoy the benefits of speed, stability, easy to use and even being very small, not megabytes of code. Wasn't love at first sight, I was working on a server with many "security rules and limitations" and the only thing available out of the box was Perl, PHP was denied to me at the moment so it was JSP or PERL. After seeing the many problems the team was having with JSP had to go with PERL and grow there pausing my experience on PHP. It wasn't that difficult for me to prefer it over PHP hands on.

It's fast, lots of modules, it's free (sure php is also free), you can have diff versions of Perl on the same server, has a lot of functions, small code, it's everywhere and stable over time. I read something above that is not quite true, you can actually find Perl very easy on most if not all servers, no extra charge. Among the many things I could mention of benefits over PHP I selected just one: stable over time. I don't like the fact that you can develop an app with PHP using a command and find it removed from the language after a few versions, no, it's not funny. Working code should keep working, Perl is not like that! I saw enough nightmares on PHP and experienced a few, on the same line: Symphony, a framework suffers of the same... things, and it runs on PHP.

Enough of that, I think is one of those things that... if you really try it (really) you like it.

PS. Documentation? there is a lot, very clear. I've found only a few cases on specific special functions where the explanations don't make sense (to me) but the code works. And some functions are very cryptic just as if complex htaccess just married some regex rule, but any problem seems easier to deal with on that world than on PHP (seen enough stackoverflow threads).
5:00 pm on Oct 26, 2015 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts: 2870
votes: 159


I have no doubt I would prefer Perl to PHP, what I do doubt is that I would prefer it to Python or several other languages.
1:24 am on Feb 23, 2016 (gmt 0)

Junior Member from PE 

10+ Year Member

joined:Mar 28, 2004
posts: 144
votes: 0


I am just learning Perl. I I understand PHP well.

I was actually trying to learn CGI for some web development, but learning CGI without knowing some Perl basics is a pain. So, now I am learning Perl first. I know some say CGI is outdated, but I just thought I should learn CGI before trying Mason or any other templates.

So, from my statement above you can deduce, that in order to really use Perl for web development (PHP's only use) you need to understand both CGI and Perl. So, you have two learn two things. Moreover, it is a pain to have to upload files, only to the cgi-bin, and get 500 errors if you don't give the files the right permissions. With PHP you don't need to worry about permissions, you just upload files, and start working with your scripts.

Getting a 500 error is scary for most beginners, and learning about file permissions which is not an easy task if the book you are learning Perl from does not mention your FTP client is a complete hassle.

So in essence, I think most people avoid Perl because of:

Learning CGI besides Perl to use Perl for web development.
Getting 500 erros, or any other errors.
Not being able to use Perl scripts in some other directory than cgi-bin, unless you use the right handlers in .htaccess, so than means having to learn about .htaccess, as well as handlers which is not necessary with PHP.

At the end I think it is about convenience. It is easier/faster to learn PHP, but I am finding Perl useful even with the basic stuff. Running scripts from command line is far faster than using scripts from within a browser.
6:37 am on Feb 23, 2016 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts: 2870
votes: 159


Why would you want to learn CGI in particular? To learn the underlying technology? You would do better to write a simple web server to learn HTTP.

Why Perl rather than Python or Ruby? I do not see why it is preferable to either of those. The Perl advocates here seem to compare it only to PHP.
7:29 am on Feb 23, 2016 (gmt 0)

Junior Member from PE 

10+ Year Member

joined:Mar 28, 2004
posts: 144
votes: 0


Perl can be used to extract data from within Excel files which is what I want to do with Perl.

Perl regex is the best in the maket. Even PHP uses PCRE, and PHP is only good for web development.

The Importance of Perl: [web.archive.org...]
9:09 am on Feb 23, 2016 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts: 2870
votes: 159


Perl can be used to extract data from within Excel files which is what I want to do with Perl.


Which you can also do with Python or Ruby or a lot of other languages.

The article you link to is nearly years old, has been removed from the O'Reilly web site, and most of it would (again) apply to Python or Ruby.
9:37 am on Feb 23, 2016 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:9235
votes: 780


We get you like Ruby and Python ... last I looked, this was a Perl thread. :)
10:10 am on Feb 23, 2016 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts: 2870
votes: 159


The thread title is "Why do so many avoid Perl?". This is not a Perl thread, it is a Perl comparison thread. Every single reply in the thread has mentioned another language. The difference between my replies and those of the Perl advocates ONLY compare Perl to PHP.

I mention Python and PHP as examples, because they are widely used for web development. What I am really asking is why would you use PHP rather than Python or Ruby or Go or C# or ..........

People are not "avoiding" Perl. We have just have no reason to use it because, once you compare it to the full range of available languages rather than assuming PHP is the only alternative, there is a lot less reason to use it. I agree Perl looks pretty good compared to PHP, but Perl advocates seem to assume that if you do not use Perl you MUST use PHP.
1:26 am on Feb 24, 2016 (gmt 0)

Senior Member

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

joined:Mar 30, 2006
posts:1574
votes: 119


RominosJ: Getting a 500 error is scary for most beginners
I love using perl and you are right, many times in the past I wished the error said something more informative, sometimes it does, sometimes it's just a line of "error blah blah" and one had to check the error logs, I'm sure there are ways to get some more info in diff ways, and I guess there are security reasons for this being the default, you never know when something on the server can go wrong and nobody needs the pages trowing that info to the user "variable X on Z line says blah blah".

Perl is fast, reliable, lots of good things I can say and I love using it. I've built some powerful stuff using little memory and little resources while dealing with a lot of data, fast. Anyway I don't see people interested on it despite this positive outcomes, it does seem scary so it seems.

Why not Perl? there are nice alternatives "easier" to use, and this depends on the user who decides "this feels easier". Anyway there are other reasons I think: there are things demanding scripts on the DIY world (machines, interfacing scripts/computers with ics, controllers, etc. And it's easier to find approaches on Python, C# or Java, not PHP or Perl. So, that could be a positive window of opportunity for Perl.

@Graeme you are right, the comparison with PHP almost comes on every time. I believe Perl "had" a weak spot on in-page-code. At the beginning I hated having html on one side and scripts on the other, that's something that could be achieved using SHTML pages to embed perl code on the html, or using some mod rewrite, but still they are two worlds apart, and it's something PHP allowed: one file with html and code, period. I had envy for this at the beginning, not-any-more. It's surprising how MVC frameworks became so popular separating the code from the design/view/templates etc. So even PHP ended up having diff forms of separating scripts from the rest.

Perl, to my knowledge and personal opinion, has a lot of positive things and it's my weapon of choice.
2:13 am on Feb 24, 2016 (gmt 0)

Junior Member from PE 

10+ Year Member

joined:Mar 28, 2004
posts: 144
votes: 0


@graeme_p in order to say that something is better or worst, we need a frrame of reference, so in this case we use PHP to compare it to Perl, even though we should not, because PHP can only be used for web programming. In fact, the title/subject for this thread should have been written: "Why do so many avoid Perl for web development?" because it is still in use on the command line, for automation, statistics, etc.
7:52 am on Feb 24, 2016 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts: 2870
votes: 159


@explorador, I am very much an advocate of MVC frameworks. I would say that for web development you should pick the best framework for your needs in a language you like - this may mean picks more than one framework and more than one language.

@rominosj so how does Per compare if we use a different frame of reference?
7:00 pm on Feb 25, 2016 (gmt 0)

Senior Member

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

joined:Mar 30, 2006
posts:1574
votes: 119


I suspect on two things affecting perl. I faced such things and adapted (and now love it), but I guess it means a lot to new developers.

1. Perl scripts don't run just because, they need a FIRST LINE having specific content, well written, the right one for your server.
2. Perl scripts need to have specific file permissions in order to be executed.
3. The server must have permissions to execute the perl files (not as common as #1 or #2).

So, compare the so many attracted or convinced by PHP, they open the text editor, write some stuff, if it's right, it will run. The same newbie tries the same on perl... "ok this line goes here, why? why the same on every file? why not avoiding this?", ok the newbie places the line, then... doesn't run, ok I missed the file permissions. "Oh damn, the other one was easier".

Me? as said: I adapted, learned. Besides I consider this a nice safety measure working in my favor.

@graeme, I now see those benefits more than ever, as a framework per se, as a framework one can build, and even the alike characteristics of perl as it is being kinda similar on separating things, agreed.
3:11 am on Feb 26, 2016 (gmt 0)

Junior Member from PE 

10+ Year Member

joined:Mar 28, 2004
posts: 144
votes: 0


@graeme_p how would I know? You have to tell us what you want to compare Perl to; however, if its PHP or Python, you know well already.
7:46 am on Mar 6, 2016 (gmt 0)

Senior Member from GB 

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

joined:Nov 16, 2005
posts: 2870
votes: 159


@rominosj I would be happy with a comparison with any of the things I mentioned, I I get to pick, I would say:

1) Perl vs Python
2) your favourite Perl web framework vs Django.

@explorador essentially it is easy to start with PHP on shared hosting using mod_PHP (we all probably did) and people do not move on to another language.