10 Transforming with Traditional Programming Languages
There are many programming languages, but the one that has been especially
popular in bioinformatics is Perl. It is designed to “make easy jobs easy with-
out making the hard jobs impossible” (Wall et al. 1996). On the other hand,
this does not mean that hard jobs are best done with Perl. It is still the case
that programming languages such as Java and C++ are better suited for ma-
jor system development than Perl. It is likely that there will always be a need
for a variety of programming languages. Indeed, this is perfectly compatible
with the Perl slogan, “There’s More Than One Way to Do It” (TMTOWTDI).
Perl is especially well suited to data transformation tasks, and this is what
will be emphasized here. Perl is much too large a language for complete cov-
erage in even several books, let alone a chapter in just one book. However,
the coverage should be adequate for most transformation tasks.
In keeping with the TMTOWTDI philosophy of Perl, there are many ways
to approach any given transformation task. There are also many kinds of
transformation tasks. This chapter is organized first around the kind of trans-
formation task, and then for each kind of transformation, a number of ap-
proaches are given, arranged from the simpler to the more complex. When
one is facing a particular task, whether you think of it as transformation,
conversion, or reformatting, first look to the main classification to choose the
section for your task. Within a section, all of the techniques accomplish the
same basic task. The earlier ones are simple and work well in easy cases, but
get tedious for the harder tasks of this kind. The later ones require a more
careful design, but the result is a smaller program that is easier to maintain.
Accordingly, just scan through the possibilities until you reach one that is
sufficient for your needs.
Another aspect of TMTOWTDI is that one can omit punctuation and vari-
ables if Perl can understand what is being said. This increases the possibili-