in reply to Perl vs C

Perl is a sophisticated interpreted language providing rich facilities for data manipulation out of the box. Many people refer to it as a "high level" language for that reason and because it uses reference counted memory management. It has inherited large components of its syntax from C and large chunks of its richness from several other languages. It provides dynamically typed scalar variables, dynamically sized arrays of scalars, hashes of scalars keyed by strings and a variety of more exotic scalar types. Perl does not provide pointers, but scalars may be assigned references to various entities (including arrays, hashes and subroutines). Perl is written in C and is relatively easily ported to new systems. Perl applications can be highly portable including between different operating systems.

C is a simple compiled language providing a small number of fundamental types and no I/O at all. Much of C's utility is provided by a fairly standard set of functions supplied in the C Runtime Library (CRL) along with the compiler. C provides a rich set of arithmetic and logic operators (which Perl inherits). C does not provide any dynamic data structures (not even a string type), although the CRL provides ways of allocating and disposing chunks of memory under programmer control. C provides various integer types, fixed size arrays, structs, unions and pointers. C is easy to implement on new systems and is thus often the language of choice for bootstrapping new systems. C applications can be highly portable but tend to be more affected by CRL implementation details than Perl.


True laziness is hard work

Replies are listed 'Best First'.
Re^2: Perl vs C
by halfcountplus (Hermit) on Mar 15, 2009 at 04:48 UTC
    The only two languages I know with any proficiency are perl and C. I started with perl (after shell scripting and html/javascript stuff) and then decided to learn C, which is probably common (I imagine it is also common the other way around, but I bet the desire to "move downstream" is a More Significant Factor).

    ?"vs."?: I might guess that they are in fact as different from one another as you could get, despite all the similarities. Perhaps this is why you see such a proliferation of perl variants (php, ruby) alongside the proliferation of C variants and stuff grounded in C, like perl itself. But "the ground" of C is really memory management, which is fundamental to everything; learning perl, it is not much of an issue initially; learinging C it is the issue initially.

    Anyway, thanks Grandfather for those two cents :) The only phrase that gave me pause is "no I/O at all", which seems oxymoronic no matter what (intuitively speaking), tho I won't argue the point further.

    ps. I just noticed the rest of the thread! I have not been using this forum in a while and got confused...so I will leave it at that and start reading, it is a topic close to my heart :)

      There is a hard to make distinction between the C language and the almost universal set of functions provided through libraries. Try using C without any #include statements and see just what isn't there - printf for a start. The same is true for many languages of course. Consider what you actually get as part of the Java language when you take out the "libraries".


      True laziness is hard work