Is Perl dead?

FP

Diamond Member
Feb 24, 2005
4,568
0
0
I have been using Perl for a long time now and used it pretty heavily for web development during the late 90's early 00's. I recently took on a project that was heavily based on mod_perl/Apache.

It doesn't seem like the language has made any progress in the 6-7 years that I have been using other things for webdev... I still use it pretty heavily for sysadmin type stuff or quick scripts but haven't developed in it heavily in a while.

Perl 6 was the buzz back when I moved on to Python and PHP.

So AT... What say you? Do you think Perl will have a revival?
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
For web dev? I don't know, dead is a strong word. I don't think Perl will overtake PHP anytime soon, and I think Python and Ruby will grow more quickly than Perl, but someone out there will use Perl for web dev. Perl 6 is not going to create a revival in any sense, IMO. It does have a relatively well-known MVC package (Catalyst), so it is still competitive feature-wise with the other languages. It's just not hip or cool anymore (and languages that fall out of that category generally don't make it back in from what I've seen).
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
I think perls strengths are elsewhere. I don't see it coming back to web development. I was a big perl guy back in the 90's before I switched to php. I still use perl for shell scripts and small things on my desktop, but I couldn't imaging using it for web development.
 

Hyperblaze

Lifer
May 31, 2001
10,027
1
81
perl is really good for system scripting. And some people still like using it for web pages.

it's not exactly the most popular one for making a web page, but doesn't mean no one uses it anymore.

 

Dravic

Senior member
May 18, 2000
892
0
76
Perl is dead as a web development tool.. this coming from a self described perl monkey? I will always use perl for systems admin scripting, automation, data file parsing etc.. but for large scale projects perl is its own worse enemy. I?m even beginning to switch to python for scripting.

The higher level languages eliminate the need to write the mechanics of the code. In ruby and python everything is an object with built in methods..

Take ruby?s use of arrays Ruby Arrays

No need to write for and while loops OVER and OVER and OVER again. The objects have common methods built in. The modern high level languages follow the DRY (don?t repeat yourself) principle.


Perl also lacks a robust web framework like ruby (rails) and python( I like django ). If you are going to be building websites on a regular basis the frameworks reduce deployment time dramatically.

Here is a python script to compare two sets of IPs(could be anything).


----------------------------------------------------------
#! /usr/bin/python

pool = open("pool.txt")
list = open("list.txt")

group1 = set(pool)
group2 = set(list)
group3 = group1.difference(group2)
----------------------------------------------------------

Group3 now contains everything in the pool missing from the list.

Write that in perl and compare line count. Now think about that difference when your writing 10,000 lines of code...

Perl does still has better regex support.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
I just wish ruby made deep coping a hash easier by default. Otherwise I love the language.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: Dravic
Here is a python script to compare two sets of IPs(could be anything).


----------------------------------------------------------
#! /usr/bin/python

pool = open("pool.txt")
list = open("list.txt")

group1 = set(pool)
group2 = set(list)
group3 = group1.difference(group2)
----------------------------------------------------------

Group3 now contains everything in the pool missing from the list.

Write that in perl and compare line count. Now think about that difference when your writing 10,000 lines of code...

But that's not necessarily a language difference, that's a library difference. That code could just as easily be perl if someone wrote functions equivalent to set() and difference() and it could be even shorter if difference() just took the names of two files. Ok, I'll admit having a general constructor like set() take a file is pretty cool and I don't know enough perl to know why it couldn't be just as cool, but I've very rarely heard people say that perl wasn't as compact as language X :laugh:

And of course any sane programmer would have written:
group3 = set(open('pool.txt')).difference(set(open('list.txt')))

(or at least I would have if not closing open()ed files didn't make me feel dirty :eek:)
 

hans007

Lifer
Feb 1, 2000
20,212
18
81
perl is pretty much dead for web stuff.

its still definitely a useful language for scripting and such, but a lot of people are moving to ruby / python for that too. i've used ruby for really basic web dev using ruby cgi (none of the rails nonsense for me haha) and scripting and find it to be a pretty powerful language except that it has some issues (like classes dont have private...etc). php is probably my favorite web language just because of the huge community and its similarity to c++ (and well i get paid to code C++ ... so i suppose thats why).



i dont think i know anyone who uses perl for webdev anymore. the only people generally who have to use it now, are people updating old sites for maintenance. and with ruby and python taking over for scripting and awk / shell for really basic stuff, i suppose its debateable just how useful perl is at this point. if you already know it well then i'm sure its plenty useful, but starting from scratch,theres a lot of alternatives now.

i do have to admit i'm not a master perl user, im not a huge fan of it because the syntax is so unstructured.
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
Everyone saying that Perl doesn't have a web framework, please, go read up:

http://www.catalystframework.org/

----------------------------------------------------------
#! /usr/bin/python

pool = open("pool.txt")
list = open("list.txt")

group1 = set(pool)
group2 = set(list)
group3 = group1.difference(group2)
----------------------------------------------------------

Here's the Perl version:
----------------------------------------
#!/usr/bin/perl

use Set::Scalar;

@pool = do { local( @ARGV ) = 'pool.txt' ; <> } ;
@list = do { local( @ARGV ) = 'list.txt' ; <> } ;

$group1 = Set::Scalar->new(@pool);
$group2 = Set::Scalar->new(@list);
$group3 = $group1->difference($group2);
----------------------------------------

So, that's one extra line for including the package for set operations. That doesn't increase if I want to have 10,000 lines of set operations or just three.
 

Daverino

Platinum Member
Mar 15, 2007
2,004
1
0
Not my code, but I've used it before:


%foo = map {$_, 1} @pool;
@difference = grep {!$foo {$_}} @list;

I gotcha beat by one line of code now.
 

hans007

Lifer
Feb 1, 2000
20,212
18
81
i suppose, all the scripting languages are only as good as their libraries and frameworks. i mean theres some fundamentaly differences between say ruby, perl , php, python, etc.

but most of what makes one "hot" is just flavor of the month, this one has the neato framework that lets me be lazierness of each.

a framework is just a bunch of functions someone else already wrote. they dont even have to be good honestly. i guess perl just got "unpopular" since it wasnt the new hotness. i would think if scripting languages went retro or something like everything is these days, perl could be the flavor of the month once again.
 

Dravic

Senior member
May 18, 2000
892
0
76
Kamper,
My point was exactly that. Having these methods built into the default objects saves a lot of time, and code. Perl can definitely be made very compact as the next few posts suggest. I used to work with a perl coder that loved using as few lines as possible to write his code. I also hated him after he left the company, and it was up to me to maintain his code.


Esun,
Cpan is a beautiful thing. I use it as often as possible, because recreating the wheel is not something I like to do. My example above just reflects on how the default methods for many things you need a module for are built into python. Even though you didn?t have to write Set::Scalar, it?s code its still counts as code length.


Set:Scalar alone uses:
use Set::Scalar::Base qw(_make_elements is_equal as_string_callback);
use Set::Scalar::Real;
use Set::Scalar::Null;
use Set::Scalar::Universe;


all totaled about 1000 lines of code will be used(or at least required) to perform the same function that is built into python.

So right now it?s 6 to 1000+ (and no I don?t need examples of other modules that require less code)

This is the purpose of the higher level languages, these common, often repeated, task should be built in methods to the objects.

I?m still 95% perl, I?m just now starting switching over. Any new code I write will be in python when it can be. Perl is still the server side standard, and will remain the primary language I code in for some time because it?s on 99% of the servers I admin by default.

By there is a big sense of relief and giddiness when you began to code as fast as your ideas come, and don?t have to write the mechanics of the language at every step. Coding is starting to be ?fun? again.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: Dravic
Kamper,
My point was exactly that. Having these methods built into the default objects saves a lot of time, and code. Perl can definitely be made very compact as the next few posts suggest. I used to work with a perl coder that loved using as few lines as possible to write his code. I also hated him after he left the company, and it was up to me to maintain his code.


Esun,
Cpan is a beautiful thing. I use it as often as possible, because recreating the wheel is not something I like to do. My example above just reflects on how the default methods for many things you need a module for are built into python. Even though you didn?t have to write Set::Scalar, it?s code its still counts as code length.


Set:Scalar alone uses:
use Set::Scalar::Base qw(_make_elements is_equal as_string_callback);
use Set::Scalar::Real;
use Set::Scalar::Null;
use Set::Scalar::Universe;


all totaled about 1000 lines of code will be used(or at least required) to perform the same function that is built into python.

So right now it?s 6 to 1000+ (and no I don?t need examples of other modules that require less code)

This is the purpose of the higher level languages, these common, often repeated, task should be built in methods to the objects.

I?m still 95% perl, I?m just now starting switching over. Any new code I write will be in python when it can be. Perl is still the server side standard, and will remain the primary language I code in for some time because it?s on 99% of the servers I admin by default.

By there is a big sense of relief and giddiness when you began to code as fast as your ideas come, and don?t have to write the mechanics of the language at every step. Coding is starting to be ?fun? again.

Sounds like you would like Ruby on Rails :)

 

Dravic

Senior member
May 18, 2000
892
0
76
It was actually looking at ruby that turned on the light about how much cleaner and easier the higher level languages are. The only ?real? difference between ruby and python comes down to ruby being able to change the functionality of the built in methods. Which, I don?t see myself needing. A lot of the code I use will be maintained by others down the line, and a change to a default method could really be trouble down the line of the life of the code. It was also pythons wider default install support that has an edge on the server side. I found that a larger drawback then the indention requirements of python.

I?m not as big a fan of rails for ruby or zope/plone for python. They both just seem to create so much complexity under the hood(ruby), or have a ridiculous learning curve to become familiar with the internals(zope/plone). I?m looking for something that ties all the pieces (web server, DB, language) into a framework, but doesn?t make customization or modification of the framework a major chore. So far I like python?s django. But I?ve really just now started getting back into web programming in an effort to flush out my Small business consulting skill set I can offer.

It?s a bad comparison but the only one I can think of? Its like writing a web page using MS word(or some other ill suited wysiwyg).. It works, it simplifies the process, so much is included by default, but the underlying code it generates makes me want to hurt someone. But I do realize 99% of the time there will be no need to get into the underlying code, hence the reason for using a framework to begin with.

I?m also not looking for a CMS like drupal, I?m looking for a framework for writing web apps, that also has some of those default modules (blog, comments, authentication, etc?), but will(or can) really have a lot of custom functionality?
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: Dravic
It was actually looking at ruby that turned on the light about how much cleaner and easier the higher level languages are. The only ?real? difference between ruby and python comes down to ruby being able to change the functionality of the built in methods. Which, I don?t see myself needing. A lot of the code I use will be maintained by others down the line, and a change to a default method could really be trouble down the line of the life of the code. It was also pythons wider default install support that has an edge on the server side. I found that a larger drawback then the indention requirements of python.

I?m not as big a fan of rails for ruby or zope/plone for python. They both just seem to create so much complexity under the hood(ruby), or have a ridiculous learning curve to become familiar with the internals(zope/plone). I?m looking for something that ties all the pieces (web server, DB, language) into a framework, but doesn?t make customization or modification of the framework a major chore. So far I like python?s django. But I?ve really just now started getting back into web programming in an effort to flush out my Small business consulting skill set I can offer.

It?s a bad comparison but the only one I can think of? Its like writing a web page using MS word(or some other ill suited wysiwyg).. It works, it simplifies the process, so much is included by default, but the underlying code it generates makes me want to hurt someone. But I do realize 99% of the time there will be no need to get into the underlying code, hence the reason for using a framework to begin with.

I?m also not looking for a CMS like drupal, I?m looking for a framework for writing web apps, that also has some of those default modules (blog, comments, authentication, etc?), but will(or can) really have a lot of custom functionality?

That's exactly why RoR is so great. Very easy to install plugins for such things as blogs or authentication mechanisms, and even easier to integrate. All you really need to do is adjust your Model file for your user accounts to reflect the data you need and create the form to signup/login if you don't want to use the default one they give you.

Even if you didn't want to use a plugin it's not hard to write the code yourself. With one command you can create a 'scaffold' which is basically a fancy term for creating all the files you need for a given Model, basically your controller/views/models/database migrations. From there you just customize the views to alter the style, and customize the controller to alter the functionality of the defaults(which follows the RESTful standards).

It's easy to learn as well, I went from having 0 knowledge of Ruby and Rails to having a working website and accompanying web services within 4 weeks. The web services handle anywhere from 100k - 200k requests per day, with the website a small percentage of that.
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
I think perl is in trouble. It never was a hot web tool, only the fact that PHP is basically a sucky language rescued it.

Almost all bigger Unix-based shops now use Python as the standard language for non-web scripts, including google.

The Perl6 effect seems to be more stuck than normal. Even my most perl hardcore friend has given up.
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
This is the purpose of the higher level languages, these common, often repeated, task should be built in methods to the objects.

I think it's arguable whether something like sets should be built-in to a language (and considering how rarely I use sets personally, I would say no). However, if you think a high level language with more built-in functionality is inherently better than another language, I think you're making a highly flawed argument. You could compile all of CPAN into the perl executable so that it's all "built-in", so to speak, but I think we can all agree this would make perl worse, not better.
 

Dravic

Senior member
May 18, 2000
892
0
76
However, if you think a high level language with more built-in functionality is inherently better than another language, I think you're making a highly flawed argument.


First the only place I said python was better then perl in this thread had to do with web development.

Second, no one programming language is better at everything then another. You use the best tool for the job at hand; it pays to know more then just one language really well.

Python will never be as fast as C or C++ for places that require pure computational speed and not a ton of interaction. Since most programs today are used interactively and sit at an idle state, the domains where C and C++ were king are shrinking.

Python doesn?t natively give you direct hardware control like C, but Python does allow you to call native C functions.

Python?s regex and text manipulation functions are not as ingrained as perls.

I have no urge to get into perl vs. python debate, it?s old and tired. But I do feel the higher level languages are better for most programming domains today precisely because the do remove some of the tedious work of coding.

The concept is referred to as DRY ?don?t repeat yourself?. The idea behind coding is to actually produce working programs. The DRY principle helps greatly to reduce the development time required to produce functional code. Do you actual enjoy writing the mechanic of your programs again and again and again? The sets things above were just one example. Everything in the new higher level languages is an object with the MOST COMMON uses of those objects built in.

Nobody is talking about taking every module everyone ever built and loading it all up. That?s just nonsensical, it?s apples to oranges.
 

Brazen

Diamond Member
Jul 14, 2000
4,259
0
0
Originally posted by: esun

----------------------------------------------------------
#! /usr/bin/python

pool = open("pool.txt")
list = open("list.txt")

group1 = set(pool)
group2 = set(list)
group3 = group1.difference(group2)
----------------------------------------------------------

Here's the Perl version:
----------------------------------------
#!/usr/bin/perl

use Set::Scalar;

@pool = do { local( @ARGV ) = 'pool.txt' ; <> } ;
@list = do { local( @ARGV ) = 'list.txt' ; <> } ;

$group1 = Set::Scalar->new(@pool);
$group2 = Set::Scalar->new(@list);
$group3 = $group1->difference($group2);
----------------------------------------

Here's the Ruby version:
----------------------------------------
#!/usr/bin/ruby

group3 = File.readlines("pool.txt") - File.readlines("list.txt")
----------------------------------------

:D