Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What dynamic programming features of Perl should I be using?

Tags:

c++

c

perl

I am pretty new to scipting languages (Perl in particular), and most of the code I write is an unconscious effort to convert C code to Perl.

Reading about Perl, one of the things that is often mentioned as the biggest difference is that Perl is a dynamic language. So, it can do stuff at runtime that the other languages (static ones) can only do at compiletime, and so be better at it because it can have access to realtime information.

All that is okay, but what specific features should I, with some experience in C and C++, keep in mind while writing code in Perl to use all the dynamic programming features that it has, to produce some awesome code?

like image 629
Lazer Avatar asked Sep 01 '10 21:09

Lazer


People also ask

Why Perl is the best?

#1 Perl is best suited for Text Manipulation In fact, Perl has been the goto language for regex, HTML parsing, JSON manipulation, etc for almost three decades. Quite simply, no other programming language provides more powerful or easy-to-use ways of manipulating text.

How is Perl different from C programming?

Perl is an interpreted programming language. C++ is a general-purpose object-oriented programming (OOP) language. Perl can use closures with unreachable private data as objects. C/C++ doesn't support closures where closures can be considered as function that can be stored as a variable.

What does Perl stand for?

Perl, which has sometimes been said to stand for “practical extraction and report language,” was influenced by existing programming languages—such as C, BASIC, and AWK—but it also reflected Wall's linguistic background in its extensive use of common English words.

Is Perl dead?

Companies still choose Perl because they know they can rely on it, which is why, against the expectations of some, Perl is doing just fine.


1 Answers

This question is more than enough to fill a book. In fact, that's precisely what happened!

Mark Jason Dominus' excellent Higher-Order Perl is available online for free.

Here is a quote from it's preface that really grabbed me by the throat when I first read the book:

Around 1993 I started reading books about Lisp, and I discovered something important: Perl is much more like Lisp than it is like C. If you pick up a good book about Lisp, there will be a section that describes Lisp’s good features. For example, the book Paradigms of Artificial Intelligence Programming, by Peter Norvig, includes a section titled What Makes Lisp Different? that describes seven features of Lisp. Perl shares six of these features; C shares none of them. These are big, important features, features like first-class functions, dynamic access to the symbol table, and automatic storage management.

like image 55
szbalint Avatar answered Oct 20 '22 21:10

szbalint