views:

122

answers:

4

I'm a Ruby developer (bioinformatics analysis, haven't done Ruby on Rails for a couple of years), and in my spare time I've been given responsibility for a very simple Perl-based website.

Although there are plenty of resources that teach Perl, I'm hoping for something aimed at Ruby programmers, so that I can take advantage of the similarity of the two languages. Are there any such resources, or is the traffic pretty much one-way from Perl to Ruby?

A: 

Ruby have some of the features similar to Perl, such as regex, and some string manipulation functions such as split() , join() , index() etc. So there really isn't too big of a difference (except Ruby is more OO). The best resource IMO, is still the Perl documentation.

ghostdog74
A: 

The PLEAC project attempts to implement the recipes in the Perl cookbook in other languages.

You can look at a recipe written in Perl e.g.. for string handling and compare it to the ruby equivalent.

Steve Weet
I wonder if author accepts patches - some of examples are outdated.
Alexandr Ciornii
+1  A: 

I've often found the Hyperglot "Scripting Languages: PHP, Perl, Python, Ruby, Smalltalk" quick comparison chart handy.

I don't know of any Ruby to Perl resources. But if you find any good Perl to Ruby ones then its easy to think in reverse :)

I would also recommend looking at the soon to be published Modern Perl Book github source. In particular coming from Ruby you will need to understand how context works in Perl.

/I3az/

draegtun
+2  A: 

As I tell other people, try to forget about the other languages you already know when you try to learn Perl. The extent that you understand and excel in Perl depends on how much you buy into it's philosophy and way of doing things. Trying to enforce a Ruby (or any other language) mindset is going to make that frustrating. I say more about this in How complex is Perl? Is it easy to learn?

It's easy to compare things at the very low levels, such as function or method names for the same micro-task, but don't fall into the trap of trying to translate programs line by line from Ruby to Perl. People like to give tiny examples to show the differences, but to me tht most important parts are the big ideas and the structure that the language naturally wants to use.

Having said that, you might want to read Piers Cawley's stuff. He's a respected Perl programmer who did Ruby for awhile. He thought we was done with Perl, but it sucked him back in. He has various blog posts and presentations about his experience with both.

Since you're coming from Ruby, you're probably going to hate Perl's object system. That's okay, because we all do (mostly), but it gets the job done. You might have a better time if you start straight off with Moose, a better object layer for Perl 5.

brian d foy
"...forget about the other languages you already know..." applies to learning any programming language, no? Unless you're coming from FORTRAN, you can write FORTRAN in any language.
mu is too short
I don't know about _any_ other languages, but it's definitely true about Perl which has a mix of different styles and ideas. Languages that have the same basic lineage and syntax might carry over significant concepts of programming design and structure.
brian d foy