Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tutorial for Ruby programmers who want to learn Perl?

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?

like image 659
Andrew Grimm Avatar asked Oct 22 '10 08:10

Andrew Grimm


2 Answers

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.

like image 198
brian d foy Avatar answered Oct 24 '22 09:10

brian d foy


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/

like image 2
draegtun Avatar answered Oct 24 '22 09:10

draegtun