Tuesday 30 April 2013

What’s So Special About Perl

- 0 comments

While there are millions (if not billions) of Perl programmers in the world today, Perl has dimmed away from the spotlight considerably. There was a time when Perl was used to create CGI web pages and used to be the ONLY way to create a dynamic website. Today there are numerous such programming languages like PHP, ASP.NET and Python that have superseded it in this field. Perl only lives in the domain of System Administrator’s toolkit and some Perl hackers who are growing it further. Another setback was the relentless propaganda by Python developers to make it the most used scripting language of the world! The plan is to “kill” the champion of scripting – Perl by pointing out its weaknesses. Perl HAS weaknesses as ANY OTHER programming language like Python will also have.

But this article does not wish to fuel any rivalries between Perl and “other” scripting languages. Instead, let us find out what are the special things in Perl that keeps it’s programmers adhered to it even when the world itself moves to “other options”.

lulzfox

  • Perl has a syntax that is found in most of the other successful programming languages of today like C, C++, Java & C#. In fact this syntax was one of the reasons behind the success of C language itself that introduced it to the world. This makes Perl acceptable to programmers of these languages. Of course, this is one of the factors.
  • Perl (as pointed out a hundred times before this) stands for freedom of approach in terms of programming methods. In Perl there are multiple ways to get to the same end. If you get stuck in one method (and you don’t have time - as being at work) you can quickly try another approach.
  • Perl has a well organized and clear block structure like C that separates logical sections of code using curly braces. These curly braces might look ugly at first but experienced programmers know that these give a more clear perception of the code block in our mind.
  • Perl statements do not end with newline (as in Visual Basic, Python, etc.), they end with a semi-colon. This gives it the same benefit as in C or more popularly in JavaScript. The entire source code can be written in a single line! I mentioned JavaScript because jQuery source files are distributed in two forms- one properly formatted code and second- with all “white spaces” removed and entire code on a single line. Why so? Because if that script file needs to be downloaded and run, removing useless white spaces will make the file smaller. Same applies to Perl source files as well.
  • Perl is like molten wax. Yes, you can mould it into different forms according to your preference. You can use Java-like block structure or Visual C++ like. You can use special Perl variables for quickly setting/getting values before/after subroutine calls or define your own.
  • The Perl CPAN network provides millions of pre-developed and optimized libraries ready for your use. However, if you can make better code than any module available there then you are most welcome!
  • And yes, the most bragged about (it is real though) is Perl Regular Expressions and other advanced text processing abilities built-in that is second to none (second to “NONE” only LOL).
  • There are many more technical advantages AND disadvantages of Perl but they are for advanced users. This is for beginners who seek to gain Perl wisdom.

Perl does have many bottlenecks and problems that have not been given a proper solution as yet (workarounds are used instead. For example using “Try::Tiny” module for cool exception handling because Perl does not have in-built “try..catch” statements). Passing more than one array to a subroutine and Perl dereferencing techniques have also been widely criticized.

But, one thing most people (intentionally or un-intentionally) fail to understand that Perl is not growing only as a language but also with its modules that are contributed and maintained by Perl hackers worldwide! Perl tries to achieve one end with a focus. You will hardly listen any Perl programmer to be himself/herself quarrelling with any language evangelist (like Python enthusiasts). Perl has been misunderstood and accused by people who themselves do slavery of a programming language that dictates even how many EXACT white spaces you have to leave before a statement! Now, that’s some “cyber Nazism” LOL.

I won’t go and criticize them for what they are doing (and waste my time). Instead it is better to KEEP CALM.. AND KEEP CODING.

Smile

Read More »
All Articles © Asit. No Copying. Powered by Blogger.
 
Copyright © . The Tech Veda - Posts · Comments
Markup Powered by Bluefish Editor 2.2