Selling cookie info to third-parties is a classic example of you can make money without doing evil.
RSS

Perl code highlighters

2008/04/28 filed under /perl

Perl can be a real mess, yes. Everyone knows it, a few try to disagree, but in the end, you can make Perl code look very cryptic. So maybe this post isn't really fair. Never the less, I'd like to point out an annoyance I have noticed for some time now.

All over the web, websites exist that allows you to dump some code. The website will highlight it accordingly to the chosen language. While this usually works fine, it fails a lot of times on the Perl variable $#. This special variable specifies the last index of a list. As you might guess, most highlighters see the hash and think: comment!

Let's use this code:

#!/usr/bin/perl

my @test = qw(Just another Perl Hacker);
print "Last index of the test list is:", $#test, "\n";
print "Oh, of course ... ", join " ", @test, "\n";

This is fairly easy code to follow, even for a non-Perl programmer, I believe, so it's up to you to figure out what it does ;-)

Now, let's see how a 10 random sites handle this:

Wrong (see the hash as a commenting prefix):

Correct:

Sad but true ...

Posted by: B10m | permanent link | comments (0)

Drop your comments

Name:
URL (optional):
Comments:

URL for TrackBack pings: http://menno.b10m.net/blog/blosxom/perl/perl-code-highlighters.trackback

return-member