My experience with Perl grew over the years. In graduate school, I wrote a handful of Perl scripts to stitch together a number of point tools that, together, made up a complete design/verification/FPGA implementation environment for the processor and SoC design that was the subject of my thesis.
As a hardware design verification engineer and as an EDA application engineer, I continued to write Perl scripts to do everything from log post-processing and checking, regression mining, to developing complete front-end verification tools. Perl became my #1 - it got the job done!
Inevitably, I also helped maintain a number of existing scripts that were written by other engineers. Yes, Perl got the job done, but there were times that it was at the expensive of my sanity.
My experience so far has shown that while it is easy to write scripts using Perl, the result is often difficult to maintain code. Engineers tend to treat the language as a simple shell script enhanced with regular expression matching. Most understand basic data structures such as arrays and hashes, but only a select few can grasp more complex data structures (e.g. hashes of arrays), Perl references, one liners, OOP, exception handling, CPAN modules, etc.
Now, I realize that my opinion above could be considered by some as flamebait (especially because it is not well substantiated). You can write poor code in any language, not just with Perl. Being an experienced programmer helps, but I contend that the language itself does not do its part in encouraging the programmer to write good code. Sure, you can train programmers to write better Perl code, but good luck with enforcing coding guidelines.
The purpose of this first of a series of blog posts is to introduce an alternative programming language for tasks that are typically relegated to Perl.
I first used Python in college to write a Blender 3D export script for my undergraduate computer graphics course. My initial impression of the language was not very favorable: the use of tabs for indenting, no semi colons at the end of the line, etc. I did not understand the hype.
I started to take notice of the language lately for a few reasons. First, there was a colleague of mine at Sun Microsystems that could not stop raving about the language! There is also the Google factor. If the crack computer scientists at Google have selected Python as the company's scripting language of choice, shouldn't I take a closer look? Finally, the Python community is very committed to coding guidelines and style. There are great tools available for static source code linting (pyflakes, pylint) and for enforcing the style guide (pep8).
With the above in mind, I have decided to write a few posts on the language from the point of view of an intermediate- to advanced- Perl user. Here are some of the topics that I will cover in the future, stay tuned!
- Vim Setup
- Parsing Command Line Arguments
- Program Flow and Exception Handling
- Logging
- File I/O
- Regular Expressions
- OS
- Lists and Dictionaries (and Dictionaries of Lists)