Yes, I read FAQ's Everywhere..but..

My main programming expertise for the last 10 years has been in C++, writing
engineering applications.  My question is this.  Now that I'm setting up my own server Linux/Apache..I've been interested in Perl.  I bought the first in series Learning Perl (O'Rielly), but it poses more questions than answers.  To be specific, Perl looks to be a little like the early days of spaghetti-structure basic programming, on the surface, (at least to a rookie).  I am truly wondering what in the world that I can do with Perl that I can't do with
C++.  (I've read the FAQ's, and it is my understanding that the learning curve for Perl is as steep as you want to make it, or simple for simple tasks, to very complex).  I'm debating whether to take the time to bother, as I'm not sure it's worth it or not.  Perl, from what little I know about it seems useful, but is it useful enough for a casual (non-professional IT administrator or manager, to want to bother with. (Please consider the above comment as to C++).  Also, reading various FAQ's on different sites, it is my understanding that writing CGI's without considerable experience, can make your server extremely vulnerable to
malicious attacks.  The only reasonable answer that I can find, for persuing Perl, is that it being interpreted script, saves space.  When your running 100 - 200 gig's of drive space, this isn't really a concern for me.  Wouldn't C++ also be much quicker, as it is compiled, rather than interpreted.
Please do not misconstrue this as a commentary of C++ vs. Perl.  I'm just admittedly, plain old confused. I'd be interested in taking the time to learn yet another language, if the benefits would = or > than the time and effort to learn it.  From the responses that I have received, and I truly appreciate them, it seems that I haven't communicated my questions clearly.  The two responses that I have received, so far, have been strictly comparisons of aspects of C++ vs. Perl Programming.  This was not my intent.  Please let me clarify, useful, and if you could, please be just a little specific, would it be to use Perl
vs. C++.  I can definetly see the benifits in using it for small,
utility type "scripts", but as an overall language, would it behoove me to start probing deeply into Perl, for larger apps.
Maybe a small descriptive narrative, not source, but a..well for example: you can do this much better, and in less time, type of answer.  Sorry for the poorly structered question.  Maybe this will clarify my curiosity some.  Again thanks to those who have answered, and to others who might.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There really isn't anything you can do with Perl that you can't do with C++
(If you have about 10 times as much time to spend writing the C++)
For computationally intensive tasks a C++ program can often run faster than a Perl program.
(although you can also write the computationallyy intensive parts of the program in C++ to be called as a perl module)
The benefits or effort spent in learning another language may depend mostly in you, and would be hard for us to judge.
(But I think that a fluency in Perl could also improve one's C++ programming,
-and a fluency in C++ can make the initial learning curve for Perl easier)
Kim RyanIT ConsultantCommented:
I think your criticisms are fairly subjective. Yes you can write spagetti code with Perl, as you can with any language. The quality of the code is a largely a function of the programmers discipline, not the language. Additionlly, if you use Perl in 'strict' mode you can ensure that the more crypitc apects of Perl are avoided.

As for programming speed, the only answer is to benchmark code that solves your problems. If Perl code with your type of hardware and network gives good performance than it IS fast enough. If you have to squeeze an extra 20 or 30% of speed than maybe you need C++, but Perl can be faster than C in some areas. If you can't measure something you have nothing to compare it against.

C/C++ are generally considered one of the hardest languages to learn, whereas Perl should be much easier for your non-professional IT types. Remember Perl came along about 18 years after C, and has added plenty of user-friendly functions like automatic memmory management and abolishing the need for data typing.

Finally, Perl provides CPAN, a collection of over 800 well documented modules that address a huge range of problems. It is one of the best examples of code reuse I have come across.
JbyTheLakeAuthor Commented:
Edited text of question.
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

PERL (being the Practical Extraction and Reporting Language) is really good at things like taking lots of computational data from a C++ program an formulating a stuctured report.  It's string handling functions make PERL good for dealing with large amounts of text where you need to manipulate the text brought in.

It is widely used as a the language for CGI programs because the programs can be built and implemented quickly.  Yes, you can create a cgi script with perl that opens the doors to attacks, but the same can easily be said of sh, tcl, C/C++, python..  you get the idea.  The language doesn't prevent the programmer from allowing security holes in their code.

C/C++ program are generally faster, but there are things that you can do if speed is an issue.  Aside from making sure you have plenty of RAM and sufficient processors (you optimized code doesn't do much good if it has to fight for processor time) you may want to look into the apache module called mod_perl.  This module incorporates the perl compiler into apache so that your perl scripts do not have to be compiled each time you call them.  The use of the module presents some interesting situations where (use strict and my all variables) the scope of variables can cause unexpected results.

It all boils down to what you feel comfortable writing and what you need to accomplish.
Perl is, as you guess, very good for small apps and scripts.  

Personally, I would never write a largish application in Perl, although I've seen ones that present a GUI, and query Oracle databases, and so on.  I'm not saying that it can't be done, but if I'm building something like that, I design it in C++.

As others have said, Perl is much easier to learn.  It's also easier to use, as there's no compilation stage.  

For me, it's great advantages are mulit-platform (write un Linux, run on NT), great regular expression and reporting capabilities, and the biggest one of all (for me): it's so, so simple to do sockets apps.  Ten lines of code and you've got two machines talking to one another.  

I'm no Perl expert by any means, but Perl is another feather in my cap.  And a very useful one indeed.  Perl is useful, and I encourage you to study.  There's an on-line tuorial at which  walks you through the basics.  If you know C++ a lot of it is noddy, but hte netoworking chapters and regular expressions are good if yo're not aware of what Perl can do.  

Yes, I'd say that as an overall language, it would behoove you to start probing deeply into Perl, for larger apps.
How much it would behoove you relative to the time and effort is harder to say.
I wouldn't want to write larger apps in a language I wasn't at least fluent in,
but I don't know how to become fluent in any language without writing a number of smaller apps.
But what I find easier or harder may not correspond to what you find easier of harder.  (Sometimes it seems like people have different natural styles of thinking about programs, which may or may not tend to mesh as well with the design of a particular programming language.  But, familiarity with a number of languages, even those that don't match your style, can help you to better understand what your own style is)
Personally, I find that what keeps me from writing more largish applicatons in Perl is that largish C++ applications have a tendancy to turn into smallish Perl applications:-)
But, if I'm doing something that I'm going to spend more time running than writing, I've often found it advantageous to write it in C++ instead, (after designing it in Perl)
And if "large" refers to the amount of data you need to hold in memory, rather than to the amount of code you need to write, then C++ can have advantages over perl in the amount of memory overhead it requires.  If you're low on RAM, a perl program that has to swap a lot can be a lot slower than a C++ program that can fit its data into memory.

This question seems to be abandoned. As part of the ongoing cleanup effort, I will leave a note in
the Community Support topic area which will recommend to the Moderators that they close this question.

My recommendation will be to refund the points and PAQ the question.


Experts ===>: please leave your thoughts here. <====

(NOT a moderator at EE)

I've deviated from maneshr's recommendation slightly. I have reduced the value of this question from 50 to zero, but because the Asker created his account, asked this question and has never logged in again to look at the responses, I have also reduced the Asker's available points by 200 and distributed them as follows:

jsatterl: points for you at
ozo: points for you at
terraplane: points for you at
allym: points for you at

CS Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.