Wednesday, May 06, 2009

Perl

Hi!

Since I'm teaching a Perl class tomorrow, it's on my mind so I thought I'd blog about it. I love Perl! I earned my undergraduate degree in computer engineering at RIT and did a lot of programming there. However, it wasn't until I was an intern at Intel that I learned Perl. I was working in the i960 architecture group and needed to learn Perl so that I could update the microcode validation scripts we were using. There wasn't a class available, so I bought a book and learned it on my own.

Perl is an interpreted language, so it's not necessary to compile the code. It doesn't require explicit types for the variables, so it's not necessary to pre-define them. It's a lot like C, but much, much simpler. I learned some C in college, but we mostly programmed in Modula-2, which is like Pascal. (Side note: RIT has since switched from Modula-2 to something more practical. I've been trying to convince the CE department for years that they should offer Perl as an elective. So-called *real* programmers may not use Perl, but engineers do!)

Anyway, I was given the opportunity to be the course content owner for Perl a couple of years ago and jumped at the chance. I had to re-type all 200+ slides as the previous course content owners had left the company and didn't leave a PowerPoint version of the course materials. This gave me the opportunity to streamline the material and divide it into an introductory course that covers the basics and a series of advanced modules that can be covered independently. I also took it upon myself to increase the instructor base and expand it across more Intel sites. I saw no reason for us to pay vendors to teach Perl when we have so much expertise in-house. We've gone from having instructors as six sites to having instructors at 14, including Intel sites in Israel, Ireland, Malaysia, China, India, and Costa Rica.

My plan is to teach the course at least once per quarter and I encourage the other instructors to do the same. Most do not, but since we're meeting demand it's not a major issue. I'd prefer interns these days not to have to learn on their own. We've got a great two-day course and I want everyone who needs it to be able to take it. Of course, *need* is something I'm trying to create. Unlike complied languages that are platform-specific and typically need a suite of tools to do anything useful, Perl (being an interpreted language) is very portable. It's easy to install a Perl interpreter on any platform you like (Windows, Mac, UNIX, etc.) and any well-written script will run on them all!

Learning to write code is learning how to translate your logical thought process into a common language. The language may not be readable by everyone, but it could be. It's just a matter of learning how to convert syntax to English. For example, the statement
if ($x == 1) then {$y = 0;}
can be *read* as "if the scalar variable x equals 1, then assign 0 to the scalar variable y." The ability to translate Perl code into English is required for teaching. It's also necessary to be consistent so the students get used to hearing code "read" in the same manner each time.

I'm looking forward to my class tomorrow, not only because I love teaching but because I always learn something as a result. The saying "you learn something new every day" is definitely going to be true for me over the next two days. I hope it's true for you, too, no matter what you learn...

Thanks,
Matt

1 comment:

alexchorny said...

Do you teach modern Perl (version at least 5.8.x, modules like Moose)?