Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Perl vs C

by ELISHEVA (Prior)
on Mar 14, 2009 at 20:49 UTC ( [id://750655]=note: print w/replies, xml ) Need Help??


in reply to Perl vs C

In Perl it is easier to share code between code-bases. C's verbosity and macro support tends to encourage the development of large complex bodies of macros. Code can't be compiled without the header file defining the macros, and more importantly, the C code often makes no sense unless you are an initiate in that code-base's macro "jargon".

Perl also lets one define language constructs and change the compilation process in seemingly hidden ways, but there is less incentive to use these tricks because Perl is a reasonably succinct language to begin with. Furthermore, doing this kind of magic requires some fairly advanced knowledge of Perl (e.g. understanding symbol tables or the difference between BEGIN and CHECK blocks and the contexts in which they are evaluated). As a result, customized "extensions" to the Perl language tend to be fewer, more well thought out, and better documented than your average C macro header file. (ok, I can see some disagreeing here :-) -- Perl has its own share of horrible code)

Compilation and execution are integrated in Perl whereas C is normally compiled in one phase and executed in another. This makes Perl an ideal tool for solutions where (a) things might need to be patched on the spot (b) bootstrap sequences where tool A1 generates code for tool A2 which then automates the build of tools B1,B2,B3.

In truth any scripting language could play this role. However, I find Perl is a particularly good scripting language choice because it cleanly supports a wide variety of data structures and its support for OOP allows close integration of data and action. When strictures are turned on it also does a reasonably good job of identifying misnamed variables and code that might not behave as intended. This makes it possible for one to maintain even complex scripted solutions with relative ease.

Best, beth

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://750655]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2026-01-25 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (126 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.