By the time I picked up Perl, my programming style wasn't
nearly as bad as you describe. It wasn't as good as now,
and I tended to use globals a little too much, and I
tended to think procedurally rather than in terms of
context, but I had already come a long way.
This may be because my style had already been improved
by using various other languages. From GW-BASIC I
learned to use RENUM instead of a lot of extraneous
GOTO (though some GOTO is virtually unavoidable in that
language, due to lack of nested conditionals). From
Pascal I learned even more structure, which
revolutionised the way I wrote BASIC. Then I took
college courses in assorted other languages, and I'm
sure I learned from those too, though I can't point to
anything specific (except the data structures and
algorithm analysys class). By this time, of course,
I was already a prolific commenter, and my comments
were starting to have some minimal level of quality.
In my spare time I picked up the Inform Designer's
Manual, which revolutionised the way I think about
objects. Inform was the second language (after
BASIC) that I was able to think in. Later the Gnu
Emacs Lisp Reference Manual again greatly expanded the
way I think about programming, and elisp became the
third language I think in. Perl is the fourth, and
the best so far, though I have a special fondness for
each of these four languages. (The other languages,
which I never thought in, but only translated to, I
have no special fondness for. Some of them, such as
C++, I actively dislike.)
I did write some Perl code I'm not terribly proud of,
e.g., the code behind the list of uses for peanut butter (one of my very first
projects in Perl), but even that is not nearly as
horrific as your description. If you want truly
horrible code from me, I'll have to go back to my
early years, when I was writing in other languages.
I believe I had a word scrambler program in BASIC at
one point that was going on a thousand lines and had
lots and lots of GOTO statements. At the time, I was
proud of it, because it was so much work to write.
Now, of course, I'd write it as one line of Perl and
play golf with it.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/