Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Perl Turns 25

Soulskill posted about a year and a half ago | from the added-support-for-rental-cars dept.

Perl 263

Several readers sent word that the Perl programming language turned 25 today. In his commemorative post at the Perl Foundation's website, mdk wrote, "So what does the future hold for Perl? Well I don't have a crystal ball but I cannot see the language fading from usage in the next quarter century, the truth of the matter is that even though there are languages that can do some of the things that Perl does, some of them do some things better, others do things Perl wasn't designed for, there is no language that has been designed to do the things that Perl is very good at doing. No language in the current scripting languages seems to have the flexibility, maturity and extensibility of Perl. The main power of Perl has always been its ability to quickly adapt, and be adapted, to suit purposes. ... The greatest challenges we will face for Perl is a shifting end-user base that will become more reliant on devices that are feature focused but crippled in application choice, the rise in mobile devices will continue and Perl will need to evolve to work with that. A better challenge for us to face would be the integration with electronically aware, and connected devices and systems, the apocryphal internet of things, in this Perl could be a powerful tool. I also believe that the more we see a divergence of language uses in the other scripting languages the more they will face issues in their core designs, issues that Perl avoids due to its malleable nature, what some believe is the crippling factor for Perl is likely to be its saving grace as it has the power and flexibility to cope with the shifting goalposts of an increasingly technologically reliant world."

cancel ×

263 comments

Sorry! There are no comments related to the filter you selected.

Recent convert (5, Interesting)

DCFusor (1763438) | about a year and a half ago | (#42328835)

I recently became a fan of perl as my goals changed towards things it excels at - sticking together big other functionalities easily.

Re:Recent convert (5, Insightful)

vlm (69642) | about a year and a half ago | (#42328869)

AKA I'm a CPAN programmer not a Perl programmer. Works for me! Wake me when another language has the depth of CPAN. I might switch, then. Maybe.

Re:Recent convert (5, Interesting)

DCFusor (1763438) | about a year and a half ago | (#42329003)

Yup. Me too. It's just awesome to be able to get stuff from CPAN with about the right "chunkiness" and documentation vs say trying to learn some huge monolithic library. Better yet - those cool modules often "accidnetally" document other things, like say, Gnuplot, so you can roll your own specialized versions easier than trying to understand the "native language" dox written by someone who didn't code in some other language, then translated by another non-programmer. And I can't believe I got first post.

Re:Recent convert (2, Informative)

Anonymous Coward | about a year and a half ago | (#42329187)

there is, it is called "CPAN+Gems+PyPi+Maven" ... amazing stuff out there if you're agnostic. Rubyists, in particular, seem to write amazing tools. Chef and Vagrant are two of my faves.

However, I still don't recommend you use Node.js.

Re:Recent convert (3, Informative)

Anonymous Coward | about a year and a half ago | (#42329675)

RubyGems is very expansive, but the quality of the modules that rubyists write is atrocious. The language is such a poor performer (spend 30% of the time doing GC, oh but don't worry better GC is in the next version, oh wait the next version, nm the next version), and the whole Rails community is built around absurd bloat: nobody seems to care/notice that their gems are poorly implemented for anything other than scraping something together.

libraries first (2)

bzipitidoo (647217) | about a year and a half ago | (#42329297)

When considering a new project, I look first for libraries I want to use. CPAN has the most commonly used ones, but get a little obscure, and you're out of luck. For instance, CPAN has OpenGL, but not OpenSceneGraph. Then I find out what languages interface with them. It quickly narrows down until maybe one language is left, and most often that language is C/C++. Sometimes no languages are left, and then I have to decide if I want to go through the pain of linking multiple languages, or search for more libraries. I like Perl's data types and regular expressions, but the pain of interfacing with a C library is greater than the convenience of not having to hack up custom hash functions and not bother with dynamic memory management. At least there's PCRE.

Perl 6 is supposed to address this issue. Seamless interfacing with any C/C++ libraries. If it works, would make a lot of CPAN redundant. Been waiting for Perl 6 for years now.

Re:Recent convert (0)

Anonymous Coward | about a year and a half ago | (#42329183)

When you stick things together using perl, it's called...

A Perl Necklace!

If COBOL is still around ... (1)

Kittenman (971447) | about a year and a half ago | (#42328881)

then Perl will be for a while too. Happy Birthday Perl. Your prime was memorable, and now you can just ask those kids to get off your lawn.

Re:If COBOL is still around ... (1)

smitty_one_each (243267) | about a year and a half ago | (#42329163)

Hmmm. . .Visual Basic. . .PHP. . .

Duct tape of the web (1)

Anonymous Coward | about a year and a half ago | (#42328891)

Perl is few programmers' idea of an elegant language, but it gets the job done quickly and easily in situations where you'd otherwise be racking your brain and scrolling through endless Google hits to figure out how do it with sh, awk, and sed.

When the WWW first exploded into the public consciousness, there was a very simple standard called CGI for returning dynamic content. Although CGI apps could be written in practically any programming language, the use of Perl was so dominant that newbies used to post questions like "Where can I learn about this Perl CGI language?"

Re:Duct tape of the web (1)

preaction (1526109) | about a year and a half ago | (#42329223)

They still do that, because the web is timeless. The majority's view of Perl seems to be stuck back in the 90s.

Perl Turns 25... (5, Insightful)

Frosty Piss (770223) | about a year and a half ago | (#42328905)

...And is sexier than ever.

Re:Perl Turns 25... (1)

Anonymous Coward | about a year and a half ago | (#42329177)

Especially with a perl necklace.

Python, please (-1)

Anonymous Coward | about a year and a half ago | (#42328959)

Title

Re:Python, please (2)

smitty_one_each (243267) | about a year and a half ago | (#42329185)

if __name__=="__main__",
you'll get your turn, Guido.

Re:Python, please (-1)

Anonymous Coward | about a year and a half ago | (#42329329)

It's almost 2013. There's a black President. And you're a racist asshole.

Re:Python, please (1)

geminidomino (614729) | about a year and a half ago | (#42329833)

Dafuq?

You do realize that the creator of Python's name is Guido van Rossum, and it's not a racial slur, right?

probably orange and reticulated, too (0)

Anonymous Coward | about a year and a half ago | (#42329953)

only Guidos boast about their python in polite company.

I used it. Once. (5, Interesting)

Tsingi (870990) | about a year and a half ago | (#42328979)

I wrote an app in Perl once. It was the only language that I could get to reliably connect to MSSQL from Linux.

It was fun to write, but I go back and look at the code now and it looks like Greek.

On the upside it's been running for over 5 years and having no problems at all.

Re:I used it. Once. (0)

Anonymous Coward | about a year and a half ago | (#42329241)

a good example of why perl is awesome

Re:I used it. Once. (2, Interesting)

Hatta (162192) | about a year and a half ago | (#42329415)

Sounds like Perl. Powerful, accessible to a complete beginner, reliable, and practically unmodifiable once written.

Re:I used it. Once. (1)

somersault (912633) | about a year and a half ago | (#42329977)

practically unmodifiable once written

Come on, it's not that bad if you split everything up appropriately into well named subroutines and such like.

Re:I used it. Once. (1)

CaptSlaq (1491233) | about a year and a half ago | (#42330185)

practically unmodifiable once written

Come on, it's not that bad if you split everything up appropriately into well named subroutines and such like.

This is one of the most important things anyone approaching perl needs to grok. Perl gives you enough rope to hang yourself, that's why I use it. Lack of awareness of that has bitten me in the backside enough that I've learned this lesson.

Re:I used it. Once. (4, Insightful)

readin (838620) | about a year and a half ago | (#42330139)

What I found in using Perl was that no two Perl programmers could read each others code. Much of the expressiveness and versatility that people talk about comes at the expense of a huge amount of syntax and the ability of the language to assume values (like $_ instead of requiring them to be explicit). What happens in practice is people learn a subset of syntax which is large enough to do what they need to do and it often isn't the same subset that someone else learned. And when reading someone else's code, it can be very difficult to look things up because it often isn't even clear what the syntax is (in part because so much gets assumed).

When the boss hands me a flat text file with 50,000 lines in some random format that needs to be parsed and loaded into the database, I dust off my Perl book and write a short application to read each line and spit out SQL. I don't need the safety of Java or the byte processing of C. I don't need to handle every possible exception that could be thrown when opening a file. I don't need a GUI. I just need to open a file, read a line of text, use some regular expressions, do some tokenizing, and spit out more text into a separate file. Perl is fantastic for that. But I don't find much other use for Perl.

Re:I used it. Once. (1)

arielCo (995647) | about a year and a half ago | (#42329489)

That's partly because it was your first (or one of your few) programs in Perl. You likely made things more complicated than needed for lack of knowledge and experience.
I've always said that Perl is a good fit for programmers who can recall dozens of "idioms" (memes), and keep their understanding of its unique semantics fresh. Things like keys %{ {map {$_=>1} @list} } [perlmonks.org] (implementing unique(@list)) and internalizing that every expression is ultimately evaluated as a list. Some are silly, but there's little argument about its expressiveness and flexibility.

Re:I used it. Once. (1)

Anonymous Coward | about a year and a half ago | (#42329901)

And, in python:
list = [1, 1, 2, 2, 3, 3, 4, 4, ]
unique = set(list)

Which is more readable?

Re:I used it. Once. (4, Insightful)

CaptSlaq (1491233) | about a year and a half ago | (#42330213)

And, in python: list = [1, 1, 2, 2, 3, 3, 4, 4, ] unique = set(list)

Which is more readable?

use List::MoreUtils qw(uniq);

my @words = qw(foo bar baz foo zorg baz);
my @unique_words = uniq @words;

What was that about readability?

Perl where are you tonight (3, Funny)

Wansu (846) | about a year and a half ago | (#42328993)

Perl where are you tonight
how can I now run scripts on my own
I searched the filesystem
even looked in slash sbin
They rm'd the sym link and pffft you wuz gone

Re:Perl where are you tonight (0)

Anonymous Coward | about a year and a half ago | (#42329797)

I wonder how many people know the melody that goes with this?

What's with the camel? (0)

Anonymous Coward | about a year and a half ago | (#42328999)

Please educate me on the camel icon for perl. I do not understand?

Re:What's with the camel? (1)

preaction (1526109) | about a year and a half ago | (#42329275)

O'Reilly needed something for the cover of the book (Programming Perl, now widely known as The Camel Book).

Re:What's with the camel? (2)

larry bagina (561269) | about a year and a half ago | (#42329435)

a camel is horse designed by committee.

Re:What's with the camel? (1)

fredrated (639554) | about a year and a half ago | (#42330155)

And a camel does a damned fine job in it's environment, where a horse wouldn't survive. Way to go, committee design!

REXX! (1)

BeemerBoy (24030) | about a year and a half ago | (#42329005)

FTW!

Re:REXX! (1)

gmuslera (3436) | about a year and a half ago | (#42329549)

Was pretty used with Rexx when had to start messing with perl, almost 20 years ago. Urgh, it was so ugly, at least compared with the (for me at that time) elegant rexx way to i.e. parse strings. But also noticed how powerful perl was, how much more i could do with it, and eventually moved to it as my main scripting language when moved to Linux. Now moving between it, python and bash, depending on the problem, even if i could do most with just one of them. But probably would not be using back Rexx, not sure how much the language changed, but I did.

Web Server development (3, Insightful)

Runesabre (732910) | about a year and a half ago | (#42329009)

I remember when Perl was the workhouse behind all custom web server development. One of the few times I had "fun" writing code. Such a cryptic looking language that made perfect sense the moments you are writing it and completely alien days later.

Re:Web Server development (3, Funny)

Frequency Domain (601421) | about a year and a half ago | (#42329047)

It always struck me as one of the poster children of "write-only" languages, right up there with APL.

Re:Web Server development (5, Insightful)

Anonymous Coward | about a year and a half ago | (#42329127)

Perl is write-only in the hands of stupid hacks. Oh wait, that's any language.

Re:Web Server development (1)

Anonymous Coward | about a year and a half ago | (#42329375)

More like any language but Perl, where even experts are confused by their own code seconds after writing it.

Re:Web Server development (5, Funny)

Frequency Domain (601421) | about a year and a half ago | (#42329677)

A friend was editing a perl program when his cat walked across the keyboard. It took him a while to figure out which parts were written by the cat. That's when I decided to avoid perl.

Re:Web Server development (5, Insightful)

dotgain (630123) | about a year and a half ago | (#42329761)

Your friend should look into revision control software and possibly getting the cat his own terminal. This way the cat's contributions can be easily tracked.

Re:Web Server development (2)

gorzek (647352) | about a year and a half ago | (#42330065)

You guys should be glad you don't write MUMPS code.

Re:Web Server development (1)

Maximum Prophet (716608) | about a year and a half ago | (#42329433)

That's the case with most object oriented languages these days. OO Perl is the worse. It's not just the language, it's the culture.

Instead of a simple A() calls B() and C() to do work, where B() and C() do real work, I've seen code where B() and C() are almost empty, relying on strange language contructs known only to true believers and their IDEs.

Re:Web Server development (1)

geminidomino (614729) | about a year and a half ago | (#42329897)

relying on strange language contructs known only to true believers and their IDEs.

Heathen. True Believers in perl don't use IDEs, regex generators, auto-intent, or syntax highlighters, and we don't receive our golden "@" medallions until we can determine the output of feeding our code through "perl -wt" in our heads.

 

Re:Web Server development (1)

Kymermosst (33885) | about a year and a half ago | (#42329993)

Bad coders can write bad code in any language.

There is nothing that requires that Perl code be write-only.

Why perl? (4, Interesting)

Frequency Domain (601421) | about a year and a half ago | (#42329015)

What can perl do that newer languages such as python and ruby can't do, and do more readably/maintainably?

I understand about path dependence and sunk costs, which is why we still have COBOL, I'm asking about language features that are unique to perl.

Re:Why perl? (1)

Anonymous Coward | about a year and a half ago | (#42329175)

The original use of Perl was as "awk on steroids" which I think was Larry Wall's phrase. Perl features an active model where the while loop pulls 0-terminated records from standard input, or any other file, whereas awk has the passive filter model. Once you get get past the loss of elegance, you realize that the active model gives you the full power of a high level scripting language seamlessly combined with all of the regex facility of awk.

And Perl kept growing.

Re:Why perl? (5, Interesting)

miletus (552448) | about a year and a half ago | (#42329205)

How much of readability is the fault of the language vs the developer? Cut-n-paste coding is the bane of any language.

As a perl programmer, I sometimes ask, what can python or ruby do that perl can't?

MVC web framework like Rails or Django? Catalyst, Mojolicious, etc. PSGI has taken a lot of pain out of deployment of apps.

Good, modern object system? Moose.

GUI stuff? There's Wx and Qt interfaces.

OK, embedding C looks much easier in python, but I've never needed that.

If all the CPAN stuff would just work with other languages, I'd be more willing to switch. Javascript seems to be where all the web stuff is heading anyway.

Re:Why perl? (0)

Anonymous Coward | about a year and a half ago | (#42329385)

If PERL was a decent language, there would have been no need to develop alternative scripting languages. The fact that one programmer cannot read something written by another when they're both prefoessionals in the same language is pretty damning, only PERL has that claim to fame in over 40 years of languages.

Re:Why perl? (0)

Anonymous Coward | about a year and a half ago | (#42329693)

no. there is a panel of (top-flight professional) judges that spend weeks just attempting to judge what entries *do*; those they can't understand win.

the language? C.
the contest? IOCCC -- the International Obfuscated C Code Competition!

never underestimate the complexity of a language, any language, with mutable state and impure functions.

EDIT: perfect CAPTCHA -- "perverts"

Re:Why perl? (3, Informative)

dotgain (630123) | about a year and a half ago | (#42329885)

It's worth noting that Larry Wall won the IOCCC - twice. (I don't say this to support the GP's remark, more to attest to Larry Wall's awesomeness)

Re:Why perl? (3, Funny)

Thud457 (234763) | about a year and a half ago | (#42330037)

Larry Wall won the IOCCC - twice.

That just makes him incomprehensible in two languages.

Re:Why perl? (3, Interesting)

preaction (1526109) | about a year and a half ago | (#42329395)

Surprisingly, embedding C++ in Perl is easier than embedding C. Of course, that's just my opinion, there aren't a lot of docs on the C++ topic, and I am one of the few Perl programmers who actually enjoy C++.

The Parrot VM http://www.parrot.org/ [parrot.org] is supposed to be for dynamic languages what the CLR and JVM are for Microsoft and Java respectively. If it ever makes it to prime time, then you could use your CPAN module with Ruby, or vice-versa.

Re:Why perl? (1)

Anonymous Coward | about a year and a half ago | (#42329437)

lol. PSGI being... a re-implementation of PEP 333 (WSGI for you non-Python people)?

while I will not insult the language's capabilities, or the devotion of its user base, the fact is that the language's syntax bears the abuse of 25 years of "add whatever whenever" feature-itis. sure, an experienced developer might write readable code -- it might be concise, the hairy parts might be commented/documented -- but most Perl "developers" are scripters, not programmers, and they frequently produce fugliness that then lingers until someone like me has to be hired to untangle their mess.

that being said, Perl does run the world. the obligatory xkcd [xkcd.com] applies -- as a real-life example, look to the standard Haskell compiler, GHC: an unholy mix of a Haskell language front-end, a GCC compiler port, and a final Perl script (aka "the Evil Mangler") to transform intermediate GCC output and implement features that GCC had not yet gotten around to -- TCO (tail-call optimization) and other niceties C users hadn't gotten around to clamoring for yet.

tl;dr -- happy birthday you ugly bastard!

Re:Why perl? (1)

Hatta (162192) | about a year and a half ago | (#42329583)

If all the CPAN stuff would just work with other languages

Couldn't it? Would it be possible, at least in theory, to compile CPAN modules to a binary format that could be linked to other programming languages? Is there any reason that CPAN couldn't be turned into something more like a shared library?

Re:Why perl? (3, Informative)

bill_mcgonigle (4333) | about a year and a half ago | (#42330143)

Couldn't it? Would it be possible, at least in theory, to compile CPAN modules to a binary format that could be linked to other programming languages? Is there any reason that CPAN couldn't be turned into something more like a shared library?

Yes, this is part of the perl6 effort. There are ports of all the other scripting languages to the ParrotVM being written for perl6. Once that's worked out you can write a module in Ruby, run it from Python - it doesn't matter. Use the best tool for the job (which is often the one you're most comfortable with).

Re:Why perl? (0)

Anonymous Coward | about a year and a half ago | (#42329643)

oh, and as the other jackass anon, "embedding C" in Python (actually the other way around, obviously) is much, much, much easier than nearly any other language. mostly because it was designed for that. I've heard tell of people using the Python runtime as the main loop for their not-at-all-Python-related program because it's basically a free reference-counting GC with a few other (very) nice features.

Re:Why perl? (2, Informative)

Anonymous Coward | about a year and a half ago | (#42329663)

How much of readability is the fault of the language vs the developer?

When the language's answer to new features is to add a new operator instead of a library/function call, it's the fault of the the language. That Perl now has nearly 300 operators, that is a language smell.

OK, embedding C looks much easier in python, but I've never needed that.

Understatement of a lifetime. I've had to expose C++ apis to Perl, Python, Java & C#. Hands down the worst, by several orders of magnitude, was Perl. XS should be held in front of the world for judgement as the worst abomination and abuse of the C preprocessor known to development kind. That XS is held to be the best means of expose C to Perl is an even greater condemnation. By contrast, Python's C API is clear, well documented, and for the most part, any preprocessor macros involved behave and look like well-defined functions. JNI, I've only used it a little bit, so I won't pass much judgement, but the API was fairly clear and easy to understand. C#, the same way. C# has the added bonus that if you're interfacing with a pure C DLL, you can do it with DLLImport attributes. The gotcha there is just making sure you get the function signatures and marshalling correct.

Re:Why perl? (1)

jimbo (1370) | about a year and a half ago | (#42329779)

As a Software Developer I ask what language is appropriate for the project. It'll typically be the language the organization has standardized on already because you don't want to muddle up things.

So I don't care much about language choice beyond that. Although I often approach existing Perl source with a certain tense anticipation, based on experience.

Re:Why perl? (0)

Anonymous Coward | about a year and a half ago | (#42329995)

Any comparable Perl option to Python's numpy?

Re:Why perl? (1)

bitslinger_42 (598584) | about a year and a half ago | (#42330111)

Having written in perl for the past 20 years, I started out trying to find something that perl can do that ruby can't (ruby is the only comparable language I have in my toolbelt). After a few minutes, I decided that, for the work that I do, the single feature that perl has that ruby doesn't is that I'm very familiar with how to write perl.

I've liked some of the things that I was able to do with Ruby on Rails, and could see how having a MVC framework in perl would be useful, but quite frankly, most of the coding I do these days is emergency, one-off parsing jobs that need to be written yesterday. Under those circumstances, I reach for the tool that I know best, I'm sure I could probably become equally familiar with ruby, but since I've already got one tool that does the job, why?

Re:Why perl? (1)

Trepidity (597) | about a year and a half ago | (#42329219)

For script-type usages, where I might otherwise have used bash/awk or something, Perl feels like it retains more of the lightweight, quick-to-script aspect. I like autovivification, the implicit $_ variable, etc. They can be used to make unreadable code, but in idiomatic usage they're very nice and not particularly hard to understand.

I don't really use Perl for "big" applications, though. Mostly for text processing and "glue" between other tools.

Re:Why perl? (2)

gorzek (647352) | about a year and a half ago | (#42330151)

I used to use perl as my "glue" language, too, until I got into python. Python works just as well in most cases, and usually leaves you with much more readable code. People who haven't used python before can usually figure out what some code is doing just by reading it. With perl? Good luck.

Re:Why perl? (1)

Trepidity (597) | about a year and a half ago | (#42330219)

I've used Python for some things, but somehow it just seems clunkier to me. For example, if you want to scan a text-file line-by-line and run some regexes on each line, it's much more explicit in Python: have to explicitly read each line into a variable, hoist some re.compile()s out of the loop if you don't want them being recompiled on each iteration, etc.

Re:Why perl? (2)

Maximum Prophet (716608) | about a year and a half ago | (#42329303)

Mostly inertia and a great set of libraries in CPAN.

There's even a Perl library that will hold your C code, compile it when needed, and make it easy to use.

Perl just plain works and plays well with others. Compare and contrast that with Java or Smalltalk.

Re:Why perl? (0)

Anonymous Coward | about a year and a half ago | (#42329403)

"What can perl do that newer languages such as python and ruby can't do, and do more readably/maintainably?"

For one thing, I really hate the fussiness with whitespace indentation in python. At least with perl I can arrange things the way I like. That's not to say I'm sloppy about it. My code is very consistently structured. It's that python forces me to deal with it its way, and the rules are a lot less flexible. That *one* thing drives me up the wall so much that I'll stick with perl, thanks. This is not a unique feature of perl, however. It's python that is a bit odd in that regard.

Re:Why perl? (2)

gorzek (647352) | about a year and a half ago | (#42330191)

People are still harping about this? Get over it. Python doesn't care how you do your indentation, as long as you do it in a consistent way. You also aren't wasting lines putting curly braces on everything. And you barely even have to worry about it if you're using any kind of python-supporting code editor for it. I'm not even talking about a full IDE. Even IDLE alone will do the job.

Perl is expressive (2)

Okian Warrior (537106) | about a year and a half ago | (#42329817)

Perl's strength is that it's expressive. It's not a language which is easy to learn or which generates heavily optimized code.

In the demo phase, you're not really worried about performance. The goal is to have something working as quickly as possible, and not worry too much about how fast it runs, or how much memory it takes. Overspec your demo system for the time being (ie - make it really fast and install lots of memory), and once you have a reasonable interface go back and recode it in a simpler language which can be more easily optimized.

Languages which are simple to learn (c++, for example) are generally not very expressive. You end up wasting tons of time debugging issues of memory allocation, library interface details, and datatype conversion.

Languages which are expressive are a little harder to learn, but any individual line in the expressive language does a lot more. Since you are writing fewer lines, and since the fewer lines do more, you end up making programs more easily and in less time.

Yes, the programs will execute a little slower, but as mentioned, this is not important in the demo stage. Your productivity will be much higher.

And there are lots of places where performance simply doesn't matter. Scripts usually fall into this category.

Perl was written by a linguist, not an engineer. As such, it's harder to learn (it's got tons more keywords and context), but once you get the hang of it it's much more expressive. The following single line:

@Lines = sort { $a->{Name} cmp $b->{Name} } @Lines;

unfolds into several lines of C++, plus a subroutine definition with datatype definitions. The following line:

@Files = ;

can be implemented using one of over a dozen possible library calls in C++, but is builtin in perl. You don't have to look up the library call interface specific to your system.

Re:Perl is expressive (1)

Okian Warrior (537106) | about a year and a half ago | (#42329843)

OK, that last paragraphs should read:

The following line:

@Files = <c:/Windows/*.exe>

can be implemented using one of over a dozen possible library calls in C++, but is builtin in perl. You don't have to look up the library call interface specific to your system.

Re:Perl is expressive (1)

dotgain (630123) | about a year and a half ago | (#42330057)

Languages which are simple to learn (c++, for example)

WHAT?

Re:Why perl? (1)

jgrahn (181062) | about a year and a half ago | (#42329829)

What can perl do that newer languages such as python and ruby can't do, and do more readably/maintainably?

Don't know Ruby, but Perl is distinctly better than Python for writing text filters with regexes and stuff -- the things you used to use sed and awk for. More readable code, faster execution.

(On the other hand, some people still stick with awk.)

Re:Why perl? (4, Informative)

narcc (412956) | about a year and a half ago | (#42330097)

No one cares about ruby. It's a dying little niche language. It had a good run, but that's all in the past now. To me, ruby never really felt complete. (It didn't even get a step method to its range class until 1.8.7) There was always some absurd limitation you had to work around or some needlessly obscure feature or rule to learn before you can do something obvious in just about every other language (What's up with things like this? 10.times { |i| puts i } madness!)

Python, well, python enjoys some popularity, but I just don't think it's likely to hang-on like perl. Probably because of the whitespace issue and the big 2.x 3.x split. Perl filled a particular niche really well, and was a good fill-in in a few others (remember when it powered your website's counter and guestbook?). Python never really found a home as there isn't any particular area where it really stands out -- or is even arguably a good fit. You'll find a lot of "it can be used for ..." but not a lot of "It's really great for ..."

As for readability, well, I can't say that it's a terribly readable language. I get that everyone is forced to indent their code (apparently, the whole world forgot about pretty printers) but that's not all there is to readability. Neither is readability all there is to maintainability. (You could even argue that the whitespace rules actually hurt readability, as it takes away otherwise helpful cues.)

Let's not forget that you don't have to write illegible perl code. Really, it's not required!

COBOL's staying power was due to much more than "sunk costs". It was, and still remains [infosecisland.com] , the best tool for the job. You'll find tons of failed COBOL to Java conversion projects from the late 1990's as a testament to that. It's really hard to beat COBOL on performance and even harder to find a language that's as easy to read and maintain. (Not that there isn't lots of room for improvement. It was designed to be readable, however, and it shows.) In short: It's easy to learn, easy to read and maintain, and lightning fast.

Anyhow, to answer your question: Manipulating strings is a strength that is not shared by many other languages to any significant degree, and this makes it a great fit for a broad range of applications to which python and ruby just aren't as well suited. (Working with strings in python 2.x is terrible -- even just outputting them can be troublesome due to the bizarre default behavior of 'print'. This has improved, but not much, in 3.x) I would argue that PHP is popular due in no small part to that as well (I've always thought of it as a simpler version of perl. A related note: PHP was originally written in perl.)

Crucially (0)

Anonymous Coward | about a year and a half ago | (#42329023)

He doesn't forsee a time when Perl 6 is ever released.

Commence! (1)

interval1066 (668936) | about a year and a half ago | (#42329093)

Let the obfuscated congratulations begin.

hmmm (1)

HPHatecraft (2748003) | about a year and a half ago | (#42329165)

the "guy before me" left a lot of undocumented Perl code. Some short scripts, some that are pretty involved.

I wonder how much easier it would be to understand the code were had the scripts been written in something else? Python?

On one hand, this is cool -- this is just the excuse I needed to learn Perl -- it is my job. On the other, it pisses me off that there are virtually no comments.

From an outsider perspective (not a Perl master at this time), Perl seems to me to be a distillation of Unix, albeit filtered through the idiosyncrasies of Larry Wall; the gift of Perl is brevity (and not having the declare the size of an array is pretty sweet, too).

Re:hmmm (3, Informative)

preaction (1526109) | about a year and a half ago | (#42329333)

As a Perl master, I agree with your perspective: Perl is the UNIX philosophy taken past its logical conclusion. It is more logical than shell scripts, more terse than C, greater than both for the everyday tasks that befall a serious computer user (and absolutely essential for a UNIX administrator).

Re:hmmm (0)

Anonymous Coward | about a year and a half ago | (#42329967)

no. no compiled language that I'm aware of is "terser" than C -- you have direct memory access. if you want to be completely balls-out insane, you can write completely inscrutable code that does nothing but pushes the right bits onto the right registers at the write time, the net effect being all sorts of craziness depending on OS. of course, it requires true "mastery" of a single platform.

and, unless your name is Larry Wall (or, better, Audrey Tang -- let's use the preferred name), I would hesitate to call yourself a "master."

Re:hmmm (0)

Anonymous Coward | about a year and a half ago | (#42329539)

I suppose one thing I could say is that I'd rather untangle obfuscated Perl than obfuscated C. that said, it frequently seems like Perl is obfuscated by design, while C is only obfuscated by the deviant (and those participating in the IOCCC). Python's verbosity gives it a few readability advantages: namely that it looks like pseudo-code, which most everyone can read. the maxim of least surprise goes a long way.

Difficult to understand? (1)

benjfowler (239527) | about a year and a half ago | (#42329193)

My first exposure to Perl was 15 years ago, when I was doing 'web' programming (actually, writing dinky CGI scripts), using some really primitive library (at the time, CGI.pm was "advanced")

Maybe I'm just thick, but coming from more conventional language, I never 'got' context, or how to do OO properly in Perl. I simply was never able to form a mental model of how to use it correctly.

I never did use Perl for personal coding after that (went straight to Python, because at least I could get my head around the syntax and type system).

-1 troll (0)

Anonymous Coward | about a year and a half ago | (#42329231)

which perl? the one that everyone uses and the author abandoned or
perl 5?

Oh noes (1)

korgitser (1809018) | about a year and a half ago | (#42329233)

the rise in mobile devices will continue and Perl will need to evolve to work with that

Does this mean Perl is considering to jump on to the tablet bandwagon? I cannot even imagine what that would mean for a programming language. All I do know is that we have lost many a great seamen to the sirens of tabletia. Shipwrecks, shipwrecks everywhere.

To my favorite programming language (1)

colin_faber (1083673) | about a year and a half ago | (#42329269)

eval unpack u=>q{E')I;G0@7%[2&%P'D@0FER=&AD87D@4"%;GT[97AI=}

Perl 6? (3, Insightful)

kriston (7886) | about a year and a half ago | (#42329305)

Okay, so let's have a roll call of those of us using Perl 6 in production.

Hands?

Anybody?

Re:Perl 6? (0)

Anonymous Coward | about a year and a half ago | (#42329649)

Just leavin' this here ... http://developers.slashdot.org/story/00/07/19/203221/larry-wall-announces-perl-6

Re:Perl 6? (0)

Anonymous Coward | about a year and a half ago | (#42329705)

I never put vaporware into production.

she's dead (0)

Anonymous Coward | about a year and a half ago | (#42329807)

I was waiting 4 years for Perl 6 to come, but she's barely a whisper in the programming world today. I think perl is simply too complex for the casual programmer. That complexity gives a lot of power. I was hoping for Perl 6 to fix the object oriented problems, but I gave up, and felt better. To this day, I still miss the power of perl.

Advantages of Perl (2)

Animats (122034) | about a year and a half ago | (#42329487)

  • Better syntax than Bourne shell scripts.
  • Preinstalled on most servers.
  • Programs from 1998 still run. (Unlike Python, where the Little Tin God keeps making incompatible changes.)
  • The CPAN library has some quality control and maintenance.
  • No vendor can make it go away.
  • Fast regular expression processing.
  • Closures! Although most Perl programmers don't know that.

The syntax is unreadable, of course. And Perl 6 seems to have been rejected by the market. Still, it's a vast improvement over shell scripts.

Re:Advantages of Perl (2)

Maximum Prophet (716608) | about a year and a half ago | (#42329639)

That, I think is the key to why Perl is still around.

Shell scripts are quick and easy, they work and play well with others, but they quickly get unmaintainable after a page or two.

Perl has local variables, real functions, and it also works and plays well with others.

You really can do 90+% of everything you might want to do in Perl. Add in C code if you need something to be very fast, and you're up to 95+%. Well written Perl is no less readable than any other computer language, and more readable than most.

Re:Advantages of Perl (1)

jgrahn (181062) | about a year and a half ago | (#42329895)

Better syntax than Bourne shell scripts.

For the old Bourne shell I agree, but IME bash syntax can be distinctly better than Perl for certain tasks -- typically stuff that's rather heavy on glueing other stuff together. And bash is becoming universally available, too.

And.. C turned 40 (0)

Anonymous Coward | about a year and a half ago | (#42329721)

I believe an honorable mention of C is needed if we're discussing anniversary years.

Limited by ecosystem more then capability (0)

Anonymous Coward | about a year and a half ago | (#42329809)

Having been hard core perl for many years and built and sold businesses based on it I can attest that it is a capable platform. However, in my experience, good perl developers have become hard to come by and are typically more senior and hence more expensive. Additionally, perl (right or wrong) does not have a reputation in IT as cutting edge or capable and when seeking investment or taking a company to market gives the impression of development team stuck in ancient technologies for which few experts can be found. That and the tiresome nature of hack like coding fades to make perl more relevant (inside-out perl objects for example) prompted me to use python in my most recent undertakings and there is a palpable improvement in the ecosystem and respect level. Developer supply is a key determinant in which language and platform to use and sadly Perl's lack of sex appeal has become limiting.

Perl as a refactoring tool (1)

loufoque (1400831) | about a year and a half ago | (#42329815)

Personally, I exclusively use Perl to re-factor C++ code with regular expressions.
It's like a better sed.

I love perl (0)

Anonymous Coward | about a year and a half ago | (#42329937)

I only use perl for small projects, utilities, converters, code generators and the like.

Have lost track of the number of times I've had to open specialized binary files or muck with transforms I hardly even understood only to quickly find exactly what was needed from CPAN archive every time.

I don't think I could ever trust myself to write a large program using perl or my perl mindset that comes with it but I also know it saves me a lot of time and allows me to automate things hard to imagine being cost effective to automate any other way.

Long-time perl developer (1)

dskoll (99328) | about a year and a half ago | (#42330009)

I like Perl. My company sells software that's primarily written in Perl. It's readable and maintainable because we follow strict coding guidelines, use proper modularization, and have unit tests that make sure our POD documentation is complete and up-to-date.

That said, a few things about Perl worry me. I think Perl 6 is a distraction; someone should take it out and shoot it. I predict it will eventually be abandoned the way PHP 6 was.

Also, while CPAN is awesome, inter-module dependencies are insane. Moose is all well and good, but sometimes you don't *want* 26MB of overhead in your Perl process just to use a fancy OO system. And since more and more CPAN modules are coming to depend on Perl, fewer and fewer of them are available for high-performance systems or where memory is an issue. Sure, you can get a 64GB server pretty cheaply, but (for example) when you're running 150 processes to scan email, 26MB/process adds up pretty fast.

The worry I have with Perl is that some developers are adding features that are pretty cool in theory and may make OO programming a bit nicer but which impose way too much overhead in many cases and which implement things 99% of people won't need.

Moose -> Mouse -> Moo -> Mo (2)

oneiros27 (46144) | about a year and a half ago | (#42330203)

That's why there's Mouse [cpan.org] . And if that's still too large for you, there's Moo [cpan.org] . And when even that's still to large, there's Mo [cpan.org]

And you can select which one has the features you need, without the bits you don't care about ... but they've all got basically the same general API, so you can change it up as needed.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>