Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What are the things that Pearl can do but are harder to do in other languages

Status
Not open for further replies.

matrixofdynamism

Advanced Member level 2
Advanced Member level 2
Joined
Apr 17, 2011
Messages
593
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Visit site
Activity points
7,681
What I understand is that Pearl has been designed to make it easy to work with Text. This is what it was created for. Now we may come across very small programs written in Pearl and also really huge programs. What I do not understand and need a few examples to be given is, what is Pearl able to do easily that is hard to do elsewhere and what exactly makes people use it and learn it? Why is Pearl used so much when it comes to servers in Networking?
 

Not to start a programming language flamewar, but Perl has some pretty specific strengths and weaknesses.

Strengths:
1) Perl's regular expression syntax is extremely expressive and really easy to use. Best of all, it was built right into the language unlike most languages, which usually support regular expressions through a 3rd party library if at all. This becomes important for portability. Also, the regex syntax is *much* simpler than anything else I've seen (BOOST with C++, PCRE with C, even Python).
2) Perl is a very good prototyping language. The syntax is short and concise and the interpreter allows you to change code frequently without waiting for compilation.
3) Perl's 3rd party library system (CPAN) is immense and (the best part) fairly centralized. This means you don't have to scour the internet quite as hard as other languages when looking for something basic like a base64 decoder.
4) The 'hash' concept of Perl (what most other languages call an associative array, dictionary, or map) is extremely well developed and is built right into the language. It's real handy...

Problems:
1) Perl is *black magic*. Seriously, I think I know maybe two people who write Perl that I can actually understand, and a horde of people who push out write-only code. This is actually a problem with the language. The motto of the language is "There is more than one way to do it" (or something like that). This is a problem. While it sounds great to have that much freedom, it means that when someone gives you code to review, they probably did it in a way that makes absolutely no sense to you and will take you forever to figure out. I think that this was the main impetus for the Python language, who designed a language from the ground up to be structured and readable.
2) The object-oriented aspect of Perl was just bolted on in my opinion.
3) I have others, but it will just sound really complainy, so I'll leave them off for now :)

Why Learn Perl?
1) In case you have to fix an existing Perl script (which there are a *lot* of)
2) In case that shell script that you have lying around annoys you enough to warrant re-writting (and you never got around to learning Python)
3) You want a one-line piece of code that will do your taxes or reverse the orbit of the world :)
4) You have a really complicated text format to parse and not a lot of time to put a solution together

Anyways, I hope that helped and I didn't put Perl down too much. There are several things that it is good for, but to sum it up, think a) fast and easy regular expressions, b) quick to write, c) impossible to read.

(And yes, people write unreadable code in every language. However it just seems to be more the rule than the exception for Perl)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top