Choosing a new language
jo at durchholz.org
Thu Jan 3 16:13:55 CET 2008
Tim Roberts schrieb:
> Joachim Durchholz <jo at durchholz.org> wrote:
>>> Xah Lee <xah at xahlee.org> wrote:
>>>> [...] PHP and Perl are practically identical in their
>>>> high-levelness or expressiveness or field of application (and
>> That must have been a very, very distant point of view with narrowly
>> squinted eyes.
> Do you really think so? It seems clear to me that the syntax of PHP was
> heavily influenced by Perl. PHP lacks the @array and %hash weirdnesses,
> but most PHP code will work just fine as Perl.
It won't even parse. PHP code starts with <?php, which is AFAIK not
valid Perl. (Anything before <?php will be copied out to stdout, which,
again, isn't Perl semantics. Anything between ?> and the next <?php will
be copied through, too.)
I'm not sure whether a PHP function definition would parse in Perl or
not. It's possible that it may - but then, I don't think it will run
unless you use a humongous compatibility library.
Taking another step back, Perl has namespaces and can access shared
libraries directly. PHP has no namespaces, and you need to recompile it
to access yet another shared lib.
Libraries are very, very different. The thing that I last stumbled over
is that both have an extremely different approach to FastCGI: PHP
strives to isolate the programmer from it, Perl gives the direct
approach. (This is a philosophical difference. PHP library functions
tend to cover up for platform differences, Perl gives you the
definitions needed to detect and handle differences.)
If you take another step back, yes both languages are procedural,
interpreted languages and use $ in front of every variable.
More information about the Python-list