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


in reply to Learning 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.