I got involved in a new project where Perl is a must. I’m coming from a good Ruby foundation and want a quick introduction or mapping between Perl and Ruby as I heard that Perl and Ruby are very close in syntax (know nothing about features).
- Do you have any recommendations for me?
- What great Perl book do you recommend as an extended reference?
- What is the commonly used version of Perl right now?
I second Nathan’s book recs, though I would also mention Beginning Perl. Two bonus features are (1) it’s available freely (and legally) online in its first edition (note: this site is timing out right now, and I’m unsure if that’s temporary or not) and (2) it covers about as much as Learning Perl and Intermediate Perl combined. A con is that it’s at times more elementary that you might want. (Learning Perl goes faster and assumes a bit more – which can be a good thing.)
You might also check out this: To Ruby From Perl from Ruby’s website. Just think of it in reverse.
In terms of versions, 5.10.1 is stable, but you will come across a range. Mostly you will find 5.8.x and up, I suspect. (Just as with Ruby 1.9.1 is stable but you will find plenty of places still using 1.8.6 or up.)
Since I’m somewhat going in the opposite direction (I know Perl reasonably well, and I’m using Ruby more and more often), I can mention things that stick out to me:
.to_for making one item a float).whileblock.)0(string, integer and float),undefand the empty string evaluate asfalsein boolean tests.trueandfalse.$foois a scalar;@foois an array;%foois a hash. (Arrays in particular will bug you: they aren’t instance variables.)mykeyword.(Note that I didn’t mention the 1000 pound gorilla in the room. OO is part of what Perl is and can do, but it’s not at the center of Perl, as it is in Ruby.)