in reply to When you first encountered Perl, which feature amazed you the most?

Nothing impressed me about perl when I first encountered it :-) It was only after being asked to implement things with it that I realized how great it was. I was coming from Java at the time, and I was most impressed with how effective perl's primitive-seeming building-blocks were at building advanced programs.

For example, in Java a hash table uses objects for keys, and each object needs a properly implemented hashCode() method which implements your concept of equality for that object. In perl, hash table keys are always strings, which seemed like a short-sighted generalization, until I realized that it really did fit all problems pretty well and saved me the effort of writing those hashCode() methods or even needing strong object types for the things I was putting into it.

Likewise, the concept of underscores denoting which methods are private on an object seemed crude at first, but then it just works rather perfectly. And how the storage for attributes is just a hash key of the same name as the method... in Java and C++ it's a constant hassle that the names of methods and names of field storage share the same namespace. I love how perl separates them.

I was also impressed that even though every single attribute access is a function call and a hashtable lookup, it runs decently fast. Coming from compiled languages, I never would have believed it. (but I did have an event where one of my designs was killed by Moose performance impact, so I abandoned that ecosystem fairly early)

  • Comment on Re: When you first encountered Perl, which feature amazed you the most?