Any Perl victims care to explain this?

Matthew Hawkins matt at
Thu Apr 4 19:22:49 EST 2002

I've been tearing what's left of my hair out for two days trying to deal
with a simple problem.

Any sane programmer would like to enjoy such wonderful programming
constructs as obtaining the value of a key in a hash table (okay, a hash
table reference), like so:

$value = $table->{'key'};

But thanks to Perl, which enjoys the full power of TIMTOWTDI, one must
instead do:

if (ref($table->{'key'}) eq "SCALAR") {
        $value = ${$table->{'key'}};
} elseif (ref($table->{'key'}) eq "ARRAYREF") {
        $value = join(' ', @{$table->{'key'}});
} else {
        $value = [$table->{'key'}];

and pray to God that you don't encounter yet another random return type
and have to add yet another conditional clause to deal with it.  Each
time you need to use it.

Why?  TIMTOWDI - there is more than one way to do it, and by God we're
going to force you to use as many of them as possible.

FWIW %table is tie'd to a MySQL database (using Tie::DBI) and all
values are integers.

Unlike sane languages, where you would have something like:

int return_value_from_hash(int key) {
        return data[key];

and the programmer can rest easy knowing that they will ALWAYS get an
integer back, Perl likes to keep you on your toes and randomly selects
the return type from the list of all possible data types.  Then, knowing
that you've employed nasty secret ninja hacks like the above to work
around it, will return completely different data types the next day,
forcing you to expand the list to deal.

2/3rds of this script is dealing with this completely brain-dead
"feature", and reinforces my commitment to take out Larry Wall in
preference to Bill Gates when I finish my time machine.  The bastard
even thinks that this insanity is a good thing, as documented here:

"He criticizes other modern languages that have been developed by people
who 'try to define their languages such that you can't do anything bad.'"

Ummm dude.  Inconsistent return types are good?  Context-sensitive,
sometimes with exceptions, sometimes just plain inconsistent meanings to
built-in functions, operators and variables is good?  Line noise as the
(GPL required) preferred format for editing is good?

Pot.  Kettle.  Gravitational anomaly scale Black.

Perhaps the reason behind this need for Microsoft Windows style bloat in
Perl source code is explained further down that page:

"While at Seattle Pacific, Wall says he 'was vaguely acquainted with Bill Gates.'"

The plot thickens.


More information about the linux mailing list