http://qs321.pair.com?node_id=221891

brian d foy said it in an amusing way in a recent blog of his:
I program Perl because I am an information junkie and the fastest way to distill it is a couple of CPAN modules. If I liked programming, I'd probably use Python or Java, because I'd get to spend a lot more time programming and less time getting results and doing something else.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re: Why I choose Perl
by Ovid (Cardinal) on Dec 23, 2002 at 18:18 UTC

    One of my fellow programmers uses Python and loathes Perl with a passion. I almost sent him this link, but I realized that he would simply say "yeah, show me why Python takes longer than Perl". Sure, I could show him a few useful one-liners that you can't do in Python due to the formatting issues, but when it comes to building real applications, I simply don't know enough about Python to make a comparison. Any recommendations from anyone?

    Cheers,
    Ovid

    New address of my CGI Course.
    Silence is Evil (feel free to copy and distribute widely - note copyright text)

      I simply don't know enough about Python to make a comparison. Any recommendations from anyone?

      Learn Python :).

      Update: since this post is geting downvoted into oblivion, I'll take that as a suggestion I should elaborate on my reasoning:

      • Learning other languages will improve the way you program in Perl. You'll find new ways to approach certain problems.
      • Knowing more languages increases your employability.
      • You'll be able to examine the code of apps you use that are written in Python. You can then assess their suitability for a particular task more efficiently.
      • You will better understand the differences between the languages and be able to contribute more to a debate on their respective benefits.

      And the list goes on...

        I think your short answer deserved a ++ in itself.

        I have considered learning Python and Ruby for a while and intend to do it as soon as my projects let me relax a little (which may as well mean never). Learning something is generally good and Python has its merits. Once you know it, you might either decide that it's better than Perl at some tasks, or borrow idioms and techniques into your Perl programming practices. You might also decide it's not worth much effort and offer people detailed reasons why.

        I recently started programming in Java and even if some tasks are made infinitely tedious, the way the language is designed gave me a better insight on software design and programming techniques. Now my OO-design is a bit more careful and my Perl code a bit cleaner. And even if Perl remains my favourite language, for any new project I consider using Java and sometimes decide it's a better choice for the task at hand. Furthermore, during a talk I gave recently I could use it as a benchmark to show Perl's effectiveness at string and template handling ;-).

        Cheers

        Antonio

        The stupider the astronaut, the easier it is to win the trip to Vega - A. Tucket
        Howdy!

        By a quirk of timing, this was revealed to me at the same time I posted my reply that appeared immediately above it. It took me a moment's careful looking to confirm that it wasn't aimed at me...however, the shoe fits :)

        Right now, my new employer (big sigh of relief over leaving the coprs of the unemployed) wants me to come up to speed on the tools they use, and Python isn't one of them, but Perl is. I've already caused the head tech in my group to suggest that we need to use Perl a lot more (vice Korn shell, mostly).

        I keep telling myself that it might be useful to take a real look at Python (or Java), but somehow it never makes it high enough on my priority list.

        I call it laziness...you might call it sloth. I might even not disagree.

        yours,
        Michael


        Update: I got it in one; I'm just explaining why that approach is not suited to my situation at this time. I took all your points to be implicit...

        Hear, hear. I took the time to learn enough Python to be dangerous (I've actually used its xmlrpclib to implement a few useful things at work) and I can cite specific warts that put me off the language as a whole (other than the whitespace thing).

      Pick any five mature packages out of the CPAN, and five tasks they let you do for the cost of a download and a skim of the manpage.

      Now ask your Python friend about how long it would either be to (a) handcode that in Python, or (b) find some package in their joke-of-a-non-CPAN to do the same thing.

      "It's the code reuse, stupid." {grin}

      This gets it out of the actual coding, and into the culture. Perl culture kicks hiney.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        So what happens when Python and Java come out with their own archives? CJAN's on its way and a Python archive will be coming shortly as well (and they already have a good number of modules). Given the number of developers, I doubt they'll have much trouble finding contributors.

        CPAN's advantage is going to be quickly reduced. If you want to prove Perl's superiority, why not focus on the actual language designs instead? Who knows, maybe the discussion will lead to improvements in all of the languages. Simply saying "Perl's better because it has more modules" leads me to believe you don't know Python well enough to comment on the actual language.

        Preaching to the converted isn't much of a challenge either. If you really want a good debate on the subject, bring it up on a Python mailing list (in a nice non-flamebait way ;).

      Well ... for what it's worth ... i purchased the Python Cookbook recently and, where i find the Perl and PHP Cookbooks fun and informative, the Python Cookbook has been rather dull and tedious. I will say that i would rather use Python over Perl or C for threads, but dealing with Python's types is PITA after being spoiled by Perl. Python's sockets are nice too, as well as Python GUI's ... but when it comes to CGI, XML, system administration, databases, and data munging, i think Perl is the better choice. Still, i recommend the Python Cookbook - if you have to code Python, it is better to have it than to not have it. ;)

      Re: one-liners - i think that one-liners are a good way to show a Python programmer why Python takes longer. The idea of one-liners is that you don't have to save one-liners somewhere and then search for them later - you write them on the spot, ad lib. They are true throw-away scripts, much like Python coders use the command-line interpreter to test code. The more one-liners you write, the better you get at coming up with one-liners on the spot. I'm not saying that one cannot write one-liners in Python ...

      python -c 'print [x for x in ("just","another","python","hacker")]'
      but without options like -n, -p, -M, or -a, Python just doesn't cut the mustard regarding one-liners. Since all these options do is basically add canned code, the only reason i can think of why Python does not offer similar functionality is because the Python camp did not even know that such functionality is useful and desired.

      Now, if i were a manager i would probably choose Python, but only if my programmers were not skilled enough to use a powerful and dangerous language like Perl. I was not ready for Perl until about 4 years after i was introduced to it, but now there seems to be no going back. :)

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
        I was not ready for Perl until about 4 years after i was introduced to it, but now there seems to be no going back.

        Very true. I wrote some horrible Perl code for 2-3 years before I even started to fully grasp it, and I'm only now feeling anywhere near confident that I'm writing decent code, nearly 5 years later. (Though I think that someone who has been exposed to other truly list oriented languages like LISP will have significantly less trouble.) And while the code I used to write is a far cry from what I can do now, I'm still nowhere close to a merlyn or Abigail.

        "Powerful and dangerous" is a very good way to describe the language. You need a fair bit of excercise to wield this tool well without cutting yourself, but the sheer power of the spells a vetted Perl wizard can cast is amazing.

        (Can you tell I'm totally infatuated? :) )

        Makeshifts last the longest.

Re: Why I choose Perl
by BlueBlazerRegular (Friar) on Dec 23, 2002 at 17:15 UTC
    Since I have the liberty of choosing my tools, I choose Perl because a lot of what I do is taking files X, Y, & Z and finding the matches (or in some cases, the differences), and Perl is, IMO, the best choice for this task.

    My boss is looking for results - and since Perl lets me do my job quickly, it makes me look good in the eyes of the boss, which is one of the keys to continued employment.

    The fact that Perl fits the way I work/think (which helps to make work fun) is just an added bonus...

    Pat

Re: Why I choose Perl
by djantzen (Priest) on Dec 23, 2002 at 21:06 UTC

    I like Perl for two outstanding reasons:

    • It is a disaster, but I'd rather walk freely through a salvage yard than under escort in an office building. I find that I can attribute a great deal of my growth as a programmer directly to the fact that in giving me freedom, Perl encourages me to ask continually whether what I'm doing is the better way to do it. There is more than one way to do it, and so it's up to me to decide which way I will. In other words, it is the programmer's responsibility to generate the norms by which he/she codes, rather than laboring under the dictates of an overbearing compiler. This in turn provides opportunity for reflection upon practices, and thus learning. As incredulous as this may sound, I find I've become enamoured with the bare-bones, "bolted-on" nature of Perl's support for object-oriented programming, because it causes me to think about the nature of different OO models, and to figure out which is appropriate for a given scenario.

    • Perl is wierd, and perlies are wierder. I can't tell you how much I appreciate looking at the documentation of a tool, or the code for some CPAN module, and glimpsing the personality behind it. It's not vetted and sterilized by a public relations department, it's not the result of a policy handed down from on high, but rather the result of an individual's personal commitment and passion. To be fair I guess this is largely true of the open-source world in general, but I'm of the opinion that the nature of Perl itself reinforces the expression of personality.

Re: Why I choose Perl
by Ryszard (Priest) on Dec 23, 2002 at 17:59 UTC
    /me stands up in front of a massive group of peers.

    My name is Ryszard, and I'm a perlaholic. I started using perl about two years ago and havent been dry since.

    I started using perl becuase we had an *urgent* regulatory task, a bit of research and my 1st perly was a customer facing website. I look back and weep at it. Oh the horror.

Re: Why I choose Perl
by samtregar (Abbot) on Dec 23, 2002 at 21:07 UTC
    I choose Perl for CPAN, both as a consumer and as a producer. No other language has a resource that even approaches CPAN in raw utility or ease of access. And when CPAN falls short, contributing is easy and fruitful. The chances of a useful and well documented module failing to find users on CPAN is next to nonexistent. With users come bug reports, new ideas for features and sometimes even code. Paradise.

    Before coming to Perl I was a dedicated TCL hacker. As a technology, TCL has a lot to recommend it. Its interface to C is much simpler than Perl's and the language syntax is a breeze. However, TCL's scattered equivalents of CPAN are pathetic. There's no standard for package installation and documentation so everyone does it differently. My experience releasing TCL code was entirely unfullfilling.

    Without CPAN, Perl is just one rather convenient scripting language among many competitors. With CPAN, Perl is the best environment for efficient development of software.

    -sam

Re: Why I choose Perl
by adrianh (Chancellor) on Dec 23, 2002 at 22:39 UTC

    I like CPAN - because I like doing interesting programming, and CPAN deals with a lot of the dull bits :-)

    I once justified doing a project in perl project solely because of the existance of DBI. We had information from N different databases / spreadsheets / weird-text-files at N different sites being integrated onto One Big Oracle Box.

    The boring bit - getting so we could talk about the data from all these different sources in the same way.

    DBI + standard DBDs + a couple of custom DBDs - job done.

    The interesting bit (cleaning and standardising all the data from the various sources) took quite a bit more effort :-)

    DBI is the best database layer I've come across in any language. Bar none. Nothing else in my experience even comes close.

Re: Why I choose Perl
by atcroft (Abbot) on Dec 24, 2002 at 16:21 UTC

    An excellent thread. My own two cents' worth to add (measly as they are).

    Performance and development time: There are multiple applications running on various servers where I work written in Java, and on most of those machines, very little else. Both the load and number of processes from Java on those machines is generally quite high. In one of those applications, the Java system was replaced by an in-house built Perl system, which, on the machines it interacts with or runs on, is less taxing and faster. For the in-house application of which I spoke, development time was under 40 days, while it is my understanding that the Java system it replaced, a company's existing product, took over a year to be set up to work as required. (Apples and oranges, perhaps, but many times it isn't the flavor of the juice that a company cares about, just that it is something wet that slakes their thirst.)

    Resources: CPAN is a great resource, no argument. There seems to be one other resource that I have not seen mentioned in the responses thus far-the perl community itself. From what little I have seen of programmers of other languages, perl seems to be the only one with such a strong, friendly group that doesn't mind helping a newbie programmer to the language that the word "community" can truly be used. (This site being a prime example of that.)

    Fun: Okay, I admit, I enjoy playing with perl. Perl is a very useful tool, but I have never seen as much poetry or art expressed in a language before. That people can actually enjoy using a language, in addition to getting whatever the job is done with it, is a big plus.

    The other reasons I could mention seem pretty much to have been covered already. For me, perl is a very fun, very useful tool. One of my co-workers is fond of joking, "That perl, she's a good ol' girl," and she truly is, whose acquaintance I am glad to have made.

    Update: Corrected link to CPAN, with many thanks to Aristotle for catching it and advising me of the problem.

Re: Why I choose Perl
by hsmyers (Canon) on Dec 23, 2002 at 20:18 UTC
    I choose Perl because I'm a code junkie. TIMTOWTDI implies multiple fixes per problem and of course to an addict, the only thing better than n hits is n+1 hits! I only come down to change problems (and occasionally shoes and t-shirts)...

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re: Why I choose Perl
by simon.proctor (Vicar) on Dec 23, 2002 at 22:24 UTC
    I choose Perl because it makes my tasks fun, interesting and quick.

    It also lets me go home on time.
Re: Why I choose Perl
by spurperl (Priest) on Dec 24, 2002 at 12:15 UTC
    This might sound banal to some and familiar to others, but I love writing Perl code because... it's simply fun !
    This is more than TMTOWTDI (hmm... TMTTMTOWTDI ?), I simply feel "the force with me" when I have to code some task in Perl. Its versatile constructs, combined together give a developed a lot of power !
    When things are easy, they are fun - it is a fact of life (it is much more enjoyable learning something you understand), and Perl makes many things easy. If designing a clever & efficient algorithm is required, I doubt that any language gives an advantage, but Perl helps with handy tools, and makes all the tasks around really simple and quick.

    Just my 2 c.
Re: Why I choose Perl
by Arien (Pilgrim) on Dec 24, 2002 at 09:21 UTC
    If I liked programming, I'd probably use Python or Java, because I'd get to spend a lot more time programming and less time getting results and doing something else.

    Programming is getting results; franticly flapping your wings is mistaken for actual flying.

    — Arien

Re: Why I choose Perl
by zentara (Archbishop) on Dec 24, 2002 at 15:26 UTC
    When I was in engineering school, I came to the esoteric conclusion that everything can be boiled down to "energy and time", where "power is the energy available per unit of time". Later, I came to add "information" as "patterns in the energy" Perl is the best tool I've come across for manipulating "information" . I'm not the best at it, but I love it. All I want for Christmas, is a language with the ease of Perl, but compiles to elf. (OK, maybe add a visual IDE for GTK which auto-writes the callbacks. Maybe that can wait for next Christmas).
Re: Why I choose Perl
by hding (Chaplain) on Dec 25, 2002 at 03:36 UTC
    Indeed. If something can be easily and effectively done with help from CPAN, I'll often do it that way. But honestly, if I'm faced with a problem where I need to do considerable implementation of things on my own, I'd most often turn elsewhere (typically Common Lisp in my case). It's all a matter of trying to judge which will work best.
Re: Why I choose Perl
by mpeppler (Vicar) on Dec 24, 2002 at 16:15 UTC
    I found perl nearly 13 years ago... and I never looked back.

    I use it today because it lets me do what I want without having to think too hard about how to do it...

    Michael

Re: Why I choose Perl
by pfaut (Priest) on Dec 29, 2002 at 17:39 UTC

    The first programming language I learned was BASIC on a PDP-8 in high school. The second part of that programming course covered FORTRAN and assembler. After high school I went to tech school for electronics. The school offered some optional courses on computer programming so I took them. It covered the same languages but this time it was on a PDP-11.

    When I completed tech school, I got hired by Digital Equipment Corp. as a field service engineer. I got an account on the office computers and would stay after hours programming on them. Mostly I programmed in BASIC. DEC's BASIC was a very powerful language and it was easy to throw together a program to do just about anything in a short period of time. Occassionally I'd want to do something that was beyond what could easily be done in BASIC so I'd write it in assembler.

    Eventually, I started playing with linux. By this time, I had become fairly proficient in C programming and most of my quick hacks were written in C. When I discovered perl, it reminded me a lot of BASIC due to its string handling capabilities. Over the last few years, many of my quick little hacks have been done in perl. With the wealth of libraries available from CPAN, I can usually find something that already does what I would have had to code in C or assembler before.

    These days I do a lot of C++ and Java programming. It's a bit difficult to use these languages for quick little hacks but I do like programming in an object oriented style. It just makes things a lot easier if some part of the hack turns out to be reusable. It also makes it easier to maintain code since it forces you to group related functions together in your source. Perl gives me a language with an incredible amount of power to make the difficult tasks easy without requiring a lot of overhead just to set up a program.

    Due to perl's portability, I have been able to write scripts that could run on linux under apache, on Windows NT under IIS, and on VMS under the OSU http server. Perl provides a viable scripting language for Windows where I was able to replace a dozen horidly complex and twisted command procedures with a perl program to drive the build process for our system at work.

    So, I guess the reasons I use perl are because of its portability, its power, its ability to grow with my programming abilities, and its ability to be as simple or complex as my needs require.

    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
Re: Why I choose Perl
by John M. Dlugosz (Monsignor) on Dec 26, 2002 at 04:29 UTC
    I chose Perl deliberatly, around 1992 I think. After doing a few "simple" things in C++ and knowing it was not the best language for the job (but the language I knew very well), I went on a months-long search for another language to compliment C++. I remember some of what I looked at included Icon and (hmm, that's the only name I still remember).

    Perl was a winner. It did more and was under active development, and met the requirements. I was especially pleased that although it was suitable for very small things (no includes to set up or other structure just to write hello world), it still had some support for programming in the large, namely package. That was before .pm files came along; before the huge boost Perl got with the coming of the world wide web.