in reply to Why learn Perl?

Hi Bharani!

I will talk about what I think is so cool about Perl. But first, my questions to you are: What kinds of computer problems are you trying to solve? What other languages do you know?

If you are a business major, I would recommend learning how to make Excel and Word "sit down and bark", which means learning BASIC. The macro facilities of these programs use a form of BASIC which you can use to create spreadsheets of amazing features and complexity. I have even seen very nice "point and click" GUI user interfaces implemented as a spreadsheet!

There is no single programming language that is "the answer" to all problems. I write code in a number of languages: Perl, Perl, C, C++, Java, Python, Assembly, low level micro-code (the "raw hardware" language that assembly instructions are implemented in) and roughly in that order. Perl appearing twice at the beginning is not a typo!

Perl excels at a number of things, including (but certainly not limited to): anything to do with processing text, the web or dealing with an SQL Database.

For text processing, what are called "regular expressions" (like wild cards on steroids) are implemented directly as part of the Perl language. Accessing a database is of course possible in say C or Java, but there will be a whole page of verbose code that is only a few lines in Perl.

Two of the most common errors in programming are: "off by one errors" when iterating using indices in a loop and memory leaks (a piece of physical memory just essentially disappears never to be used or seen from again - in C++ this is an extremely common error). Perl has iterators and a memory management scheme so that usually these are not problems.

Perl is "large language" with a lot of functions. I would not recommend Perl as a "first language". It is so flexible and so capable that it is hard for beginners to figure out what the right "subset" of the language to use for a particular situation.

I find that functional Perl will run at maybe 1/3 the speed of C, but I can write the Perl code 5-10x faster. OO Perl has maybe an additional 30% performance penalty. For the vast, vast majority of my programming, being able to produce a correct solution quickly is much, much more important than the speed at which the code runs. When more performance is needed, I can tweak the Perl code to make it "good enough" or change algorithms rather than switching to C.

PerlMonks is an excellent place to ask detailed questions. If you can find an organized class for beginners to take, that is a good way to get started. Perl requires a bit more "how to" guidance than just learning what the various functions do.

I wish you well! PS: I guess Perl should be spelled in all caps, PERL like FORTRAN, they are both acronyms. But I am lazy when I type. Update: I guess that is not right, re:eyepopslikeamosquito's post. Perl it is.

Replies are listed 'Best First'.
Re^2: Why learn Perl?
by eyepopslikeamosquito (Archbishop) on Dec 09, 2016 at 21:56 UTC

    I guess Perl should be spelled in all caps, PERL like FORTRAN, they are both acronyms

    From whats the difference between "perl" and "Perl":

    perl is not an acronym
    Though there are several backronyms in use, please note that Larry originally chose the name "Perl" -- after going through every single word in the dictionary! -- arbitrarily for its positive connotations. Actually, he originally chose "Pearl", but that name was already taken.

    From the draft Oxford English Dictionary entry cited on

    Perl Brit.
    Perl, perl, irreg. PERL
    perl n. ,
    arbitrarily chosen for its positive connotations, with omission of -a- to differentiate it from an existing programming language called Pearl. Coined by Larry Wall in the summer of 1987; the program was publicly released on 18 December of that year. Acronymic expansions of the name (such as Practical Extraction and Report Language and Pathologically Eclectic Rubbish Lister), though found in the earliest documention for the language, were formed after the name had been chosen. Coinage details confirmed by personal communication from L. Wall, May 2000. A high-level interpreted programming language widely used for a variety of tasks and especially for applications running on the World Wide Web. The form Perl is preferred for the language itself; perl is used for the interpreter for the Perl language.