Yup, I'm programming in Perl at work.
We had this nasty old perl program floating around, and when I looked into it, I could not believe the insanely bad programming. I'd like to say that the programmer was a converted Fortran hacker, but that would be too generous. I can't even assume that this programmer learned how to write perl by looking at Matt's Scripts. It's more like, he selected about 1 in 5 random lines from perltut, and kept only those bits that worked without modification. As a result, the only array operations he knows about are:
for ( @a )
@a = <F>;
$a[$i] = ...
That's sure not much to go on.
He didn't even know how to assign a list to an array. He thought the way to initialize (or "blank out") an array was with
$a[0] = "";
WTF?!!!
He also didn't know about push. In order to add an element onto an array, he would do the following:
open F, "> file";
for ( @a ) {
$line = $_; # lord have mercy.
print F "$line\n";
}
print F "new item\n";
close F;
open F, "< file";
@a = <F>;
close F;
This was done in about two dozen places in this ~5000 line program. As you can imagine, it ran like a dog.
Also, this programmer knew nothing about lexical variables, subroutine arguments, or subroutine return values. All variables global; no use strict or perl -w. ;-P
(more later...)
Re:Déjàlu
jdporter on 2002-06-27T03:03:59
Yes. On both points.
:-)