[mythtv-users] New Australian XMLTV grabber

Brian May bam at snoopy.apana.org.au
Mon Dec 13 23:31:17 UTC 2004


>>>>> "Rob" == Rob Hillis <rob at hillis.dyndns.org> writes:

    Rob> Perl makes me nervous... I've heard multiple times that it
    Rob> can be far more complex and unreadable than C/C++, and given
    Rob> what I've learnt about regular expressions, I have no problem
    Rob> believing that... :) I have no doubt what you lose in
    Rob> readability and simplicity, you pick up in bucketloads in
    Rob> flexibility, but it *does* make for a steep learning curve.

It is possible to have readable Perl code just as it is possible to
have unreadable C++ code. It is also possible to have regular
expressions (using an appropriate library) in C++.

Having said that, it seems much simpler to write unreadable Perl code
then to write unreadable C++ code when you are attempting to do the
opposite...

    Rob>           That line does look a little odd, though I'd be
    Rob> willing to bet the difference between $pids.. and $#pids is
    Rob> like the difference between a variable and a pointer, so I
    Rob> may well be wrong.

I have heard all of this is going to change in the next major version
of Perl, when it finally gets released (read: years).

I am going to assume @pids is an array, e.g.:

my @pids;

If so, then you use

$pids[0] to get the first element, or:

$#pids to get the last index of pids (no this is not the total number
of pids),

$pids[$#pids] gets the last element of pids. This is also an example
of what I mean when I say "unreadable"!

    Rob>     Perl is much more convoluted than that.

The problem with perl as far as readability is concerned, not only
does it have a numerous ways of doing exactly the same thing, but its
goes all these weird symbols, and I can never remember what each one means,

eg:

( ) vs [ ] vs { }

$# _  $@ $_ @$_ $> 

-o -w -x -d 

"" vs '' vs q{} vs qq{} vs qx{} vs qw{} vs  etc

@ vs $ vs %

== vs eq vs != vs ne

Ok, maybe I am going to extremes here, I actually have memorized some
of these, but the fact remains it isn't obvious to a non Perl expert
what these mean without looking up the documentation (and finding the
appropriate spot in the documentation too!).

Personally, I much prefer a compiled language because the compiler is
able to pick up on many mistakes that perl won't detect until you run
the code in question. However, I still use perl for quick and dirty
scripts.

Hope some of this helps....
-- 
Brian May <bam at snoopy.apana.org.au>


More information about the mythtv-users mailing list