Which language is uglier is not going to go very far here, I think - but I will give you that Perl can be ugly.
But, the fact that Perl
can be ugly is a strengh, not a weakness. One of Perl's main tenants is that there is (almost) always more than one way to do something. PHP's philosophy is a little different - basically, it tells you what the way you should do something is.
Ultimately, I suppose the biggest difference between the two comes down to how creative and intriguing you want to be with your programming. With the different interfaces you can write in a module to do the same thing - via tie()ing, autoloading, prototyping, overloading, etc. you can come up with very "cool" ways of doing things in Perl that usually don't look ugly, but rather look kindof cool.
For example, consider the following:
my $response = GT::WWW->get('http://gossamer-threads.com');
print "Response status: " . int($response->status) . "\n";
print "Response string: " . $response->status . "\n";
print "Headers: " . $response->headers . "\n";
print "Content: $response\n";
Could I do something like that in PHP? It's doubtful. Most likely, I'd have to call something that returns an array, and extract the information from various predefined positions in the array. Personally, I prefer the above - it is simple to see what it does from just looking at it. In reference to your other post, will I be able to read it 5 minutes from now? Yes. You don't know Perl, yet you can see exactly what that does. On the other hand, I can't look at your PHP example and figure out what it does.
I could write the same code so that it looked like this:
my %response = GT::Fictional::WWW->get('http://gossamer-threads.com');
print "Response status: " . $response->{status} . "\n";
print "Response string: " . $response->{string} . "\n";
print "Headers: " . join("\n", map "$_: $response->{headers}->{$_}", keys %{$response->{headers}}) . "\n";
print "Content: $response->{content}\n";
That code could do exactly the same thing - but you'd be right in this case; that is a little ugly. Many people would probably be tempted to write it that way - or worse. My point is that just because
some Perl code is ugly, doesn't mean that
all Perl code is ugly.
Jason Rhinelander
Gossamer Threads jason@gossamer-threads.com