Perl as written by ...

VSarkiss on 2004-09-29T22:24:42

I believe it was Larry who said, "You can write baby Perl and we won't laugh." I like that, and I've adopted it when working with new Perl programmers. We've all seen Perl as written by C programmers or as written by shell programmers. But some code I saw today really takes the cake. I think this is "Perl as written by a non-programmer"...

Here's the beginning, as the script's processing its args:

$size=0;
for (@ARGV)
   {
    $size=$size+1;
   }

for ($i=0; $i < $size; $i++)
   {
    $argument[$i]=shift(@ARGV);
   }
I won't post the part where the code reads the input file twice: once to count the lines, and again to pull it into an array...

I think the programmer just liked two-pass algorithms.


Suspicious

Ovid on 2004-09-29T22:44:42

Hey, that looks suspiciously like brian d foy's brace placement style. How long has he been hiding this from us? I, for one, am aghast :)

Re:Suspicious

zatoichi on 2004-09-30T02:42:31

No wonder he wants his name in all lower case! ;-)

Re: Suspicious

ybiC on 2004-09-30T15:19:04

Hey!   Did you ask for my permission to use source-code from my lastest project??

;^D

ybiC - the eternal amateur