in reply to Late night revelation of PERL

I recently had the same thought. I have used (in the last 5 or 6 years in varying contexts) Lisp, C++, Java, and Perl. Of that small set (and limited experience) I have never found a language as flexible as Perl. C++ counts its rigidness as an asset, I do not. As I see it, I want to spend my time implementing code that is directly relevant to the problem at hand, and not to spend time implementing support code.

For example... say I want to have a dynamically sized array of stuff, in Perl thats what an @array is. In C++, or Java for that matter, I would spend a day just coding the array structure that I want, and then I still would only be able to put one type of thing in it, so I would have to define an object that could contain whatever types of data I wanted to put in the array in the first place, which just gets ugly... fast.

Perl, on the other hand, has its focus on text. We have regular expressions (RegExes) and split and the concept of a $scalar instead of an array of chars [ ]. Thats what most of us work with. We want to write tools that interact with databases and web servers, scripts for system administration and automation, programs to handle e-mail and play games. Most* of that is text oriented.

Yeah, you can do math in Perl (and there are plenty of modules at CPAN to help you with the complex stuff), but when was the last time your project was to dynamically calculate the trajectory of a rocket accounting for changes in mass and size over time**? I mean really? (And if your project did involve something that complicated - Please tell me you didn't use Perl! That is definately a C or C++ problem!)

So my answer is that we like Perl because we can get things done quickly in Perl. We don't need to do any real set-up, because that's been done for us. And that Is A Good ThingTM. You see?***

Footnotes:
* I say "most" because we also have common questions like, "How do I generate a random unique number" and "How do I generate a random fully solveable maze?" which are not so much text as they are numerical and logical. But my point stands.
** Loss of mass resulting from use of fuel, and change of size in the form of metal expansion at high temprature. These are real issues involved in rocket trajectories.
*** Actually, there are plenty of other reasons, but that is the one at the top of my top 5 list: Flexability, Ease of learning, Ease of extension, Portability, Community Support.

Replies are listed 'Best First'.
RE: RE: Late night revelation of PERL
by eduardo (Curate) on Nov 07, 2000 at 11:22 UTC
    I have one bone to pick:

    For example... say I want to have a dynamically sized array of stuff, in Perl thats what an @array is. In C++, or Java for that matter, I would spend a day just coding the array structure that I want, and then I still would only be able to put one type of thing in it, so I would have to define an object that could contain whatever types of data I wanted to put in the array in the first place, which just gets ugly... fast.

    I'm sorry. but if you are in C++, use the STL. It's going to be faster than anything you can do by hand, it's going to be more secure, better tested, etc... than anything you are going to do. It's going to be easy to understand if you are willing to read a bit of documentation. And, most importantly, it's not part of the standard.

    UPDATE: oy, no perlmonking while under chemical influences... sorry extremely but i typed it in wrong. It is part of the new C++ standard. (if i remember correctly, if i am wrong, correct me.)
      This: And, most importantly, it's not part of the standard. ALONE was worth the ++ =)

      --
      $you = new YOU;
      honk() if $you->love(perl)