November 27, 2002

Looking at something new

Darren gives a nice little look at Perl from a Java developer’s perspective. One of the fun things about learning a flexible language like perl is you start wondering why you can’t do terse-but-powerful things like:

   List items = getListFromSomewhere();
   Map m = map { $_ => callMethod( $_ ) } items;

When explaining perl to people I always refer to $_ as the pronoun 'it' -- what is the loop variable? 'it' what line of the file are you massaging? 'it' (I didn't come up with this but I don't remember where I first heard it.

Doing OO in perl may make you feel dirty, but ignore that and have fun with the flexibility. Yesterday I said to one of my coworkers (when referring to our ubercool Java code-generation system written in perl): "When you know perl everything just looks like text."

That said, while there are efforts to create one I don't see a Perl5 refactoring browser being created. (Perl6 underway now is a fairly radical rewrite and should be more regular.) I wouldn't have thought this a big deal until I used IDEA for a while.

Next: Can you create an easy bake oven subclass?
Previous: java.blogs