void has asked for the wisdom of the Perl Monks concerning the following question:

Being a beginner to programing and to Perl (needless to say) I am trying to find opions about how Perl relates to all the flavors of C/C+/C++/Visual C++. I am in the process of learning Perl and would like to know how similar it is to the above list. Please no cracks about Visual C++, I know what most people think about it.


"The Universe is not only more complex than we imagine, it is more complex than we can imagine." - Albert Einstein

Replies are listed 'Best First'.
Re: Perl to C to C+ to C++ to Visual C++
by HamNRye (Monk) on Sep 06, 2001 at 02:41 UTC

    How does perl relate?? There are major differences in syntax, scope, etc. You are not directly responsable for memory management, etc. But perl allows you to get pretty "C"ish with your code if you like.

    That said, Perl will familiarize you with loops, cases, and good logical program flow. Most any language will do this. Perl, however, also supports OO, Modules (aka libraries), references, etc... These are essential for a C/C++ programmer. Using Komodo or other IDE will acquaint you with an IDE and a debugger as well.

    Finally the perl to C translators are good because you can see your perl program flow implemented in the other language. Also, the clean-up will acquaint you with C without having to start the project that way. (Which can be daunting.)

    To make a catchy phrase out of it, How much does learning welding prepare you for blacksmithing??

    But if you are planning to program C/C++, you could do worse than perl.

    ~Hammy

Re: Perl to C to C+ to C++ to Visual C++
by FoxtrotUniform (Prior) on Sep 06, 2001 at 09:41 UTC

    So, er, why did people downvote this? Seriously. I'm quite curious. Just wanted to get that all-votes-cast XP bonus and needed a node to downvote or something?

    How does Perl relate to C(++)? Perl does string munging like nothing else on the planet. Perl has integrated hashes that work incredibly well. Perl has a remarkably transparent object model, far more so than any other OO language that I've encountered (this excludes Smalltalk, for the record). Perl is incredibly idiomatic, almost as much so as vi and its clones. Perl has regular expressions that make the Goddess envious. For small programs, glue, system administration and data munging, Perl is an ideal language. And Perl has CPAN. CPAN is so effective a resource that it makes all of OOP's claims about software reuse seem lame by comparison.

    On the other hand, Perl doesn't give you much access to the computer's internals. Perl won't let you dictate much in the way of memory layout. Perl won't let you specify whether you're using 8, 16, 32, or 64 bits for a particular integer. Perl doesn't generate predictable machine code. If you want to do something really, really fast, Perl probably isn't what you want, and if you want to massage your VGA card into giving your 400x300x8bit resolution, Perl probably isn't what you want either.

    Oh, and C+ isn't a mainstream language, it's a soft drink.

    --
    :wq
Re: Perl to C to C+ to C++ to Visual C++
by perrin (Chancellor) on Sep 06, 2001 at 03:13 UTC
    You should get the Advanced Perl Programming book from O'Reilly. It has comparisons to other languages in every chapter. And then there's "Perl versus...".

      For a very nice comparison of Perl vs. other OO languages, notably C++, see Appendix B of Object Oriented Perl by Damian Conway.

      If you really want to understand the issues in comparing one language to another, you should read Essentials of Programming Languages.

      Christian Lemburg
      Brainbench MVP for Perl
      http://www.brainbench.com