[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl vs. C ?



At 09:08 AM 7/4/97 +0200, Omer Zak wrote:

>Weak sides:
>1. No complex data structures (in Perl 4; about Perl 5 I don't know 
>   enough, probably it fixed the problem).

Well, Omer, Perl 5 did fix that problem, and supports multi-dimensional
arrays, hashes of hashes or arrays (and so on), and hard references. It
also supports OOP, tieing, and other goodies. Omer, I suggest you rescan
the perl man pages, because ver. 5 has a lot of new features.

>2. Not recommended for computationally-intensive work because it is 
>   essentially an interpretive string-manipulation language.
>
>Strong sides:
>1. Very powerful string manipulation capabilities - pattern matching, 
>   substitutions, associative arrays.
>2. Very good language for writing shell scripts.
>
>> ... Can it be compared to C ? On what
>> circumstances would you use Perl and when would you use C ?
>
>I would use Perl over C when I want to write a shell script to perform 
>complex operations, when speed of operation is not of essence.  I would 
>use C over perl when I have to deal with complicated data structures.
>
>It is easy to combine C and perl, because from perl you can execute other 
>programs and process their outputs.

You can also write a C module and then make some of its functions usable
from within perl, as standard perl functions using PerlXS. I think it's
faster than calling an external compiled program.

Anyway, Perl is sort of like Tcl or Python, only much better IMO. You can
basically write everything you'd like in Perl, from scripts to full-scale
TCP/IP servers, but I wouldn't recommend it for the latter if you really
need speed. (at least not until the Perl compiler will be ready) Anyway,
Perl is also excellent for CGI scripts, database utilities, X programming
(via Perl/Tk) etc. It has loads of ready modules that perform various
functions.

	Shlomi Fish




----------------------------------------------------------
Shlomi Fish                                Smart Link Ltd.
Home: shlomif@ibm.net
Work: shlomi@slink.co.il

The Bible dictates that "Thou shalt not seethe [=cook] a kid [= young goat]
in his mother's milk." To avoid possibility of breaking that regulation,
the Jewish tradition ruled that it also applies to female goats, to mature
goats, and to the meat and milk of two completely unrelated goats. It is
also forbidden to eat the meat with fresh milk, and it applies to beef and
mutten as well (including mixing the milk and meat of two different
beasts). Finally, chicken, which are incapable of milk production, may not
be eaten along with any mammal's milk either. 

We are fortunate that most mathematicians were not Jewish. Otherwise, it
would have been forbidden to divide by all numbers between -1 and 1.
----------------------------------------------------------


References: