Re: [Hampshire] Why I like Perl

Top Page

Reply to this message
Author: Stephen Rowles
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Why I like Perl
> Every time I hear this complaint I think of myself. I say exactly
> the same thing about the majority of PHP code I touch - but that is
> probably because I'm cleaning up security holes.


I have to say I would say the same thing about PHP, in my opinion it
suffers from many of the same problems as Perl.

>
> Honestly I don't understand why Perl has this reputation. It is
> possible to do clever "tricks" in any environment interesting enough
> to be useful. Similarly a bad coder will be a bad coder regardless
> of implementation language.


My opinion comes from having spent the best part of 2 years having to work
with it on a regular basis on a large internal company system. While I
agree that a bad coder will write bad code in any language there are some
languages that make it much harder to write bad code than others.

Both PHP and Perl suffer in their OO implementation in that it only makes
it look like OO, making it far too easy for people to access the
underlying code which then makes for brittle systems when they do.

And of course there is nothing you can do to stop them, unlike other
languages that provide better encapsulation. People will always do the
wrong thing because they don't know better, are under time pressure, or
even because they think it's the right thing. If your language provides
tools to prevent people make bad short cuts, it leads to better code in
the long run. And that is especially important in large projects with
multiple developers.

>> I think perl is a good tool, just often mis-used for things where it
>> really isn't the best tool for the job.
>
> I think junior developers are good, but often mis-used for applications
> which later become important ..


junior developers are usually supervised, so you can lay the blame at the
more senior people's door for not keeping check on them. You can't do that
with Perl :)

But more seriously, if you want to write a large enterprise system, don't
do it in Perl it was never designed or intended to be used for that sort
of thing. On the other hand, if you want to quickly parse a log file to
look for errors, don't use C because it would be much quicker and easier,
and more flexible to write it in Perl.

My main beef is that Perl, which is a scripting language, should be used
for situations that are well suited to scripting languages. I am a great
believer in the right tool for the right job and while perl is a great
tool, it isn't the right one for every job, despite what some people think
;)