Hacker News new | ask | show | jobs
by ddemchuk 5737 days ago
Ok, I am a solid PHP developer, pretty advanced with Ruby, and can do front end code and JQuery with my eyes closed.

Should I be interested in Perl? Is there any reason to learn it if I know these other languages? I am genuinely curious

7 comments

I went from Perl to Ruby about 10 years ago, and I can't say there's anything I miss. Certainly, at the start, running Web apps was easier in Perl because most servers had mod_perl out of the box. But for day-to-day tasks I found I much preferred Ruby. The reasons for this, though, are as likely personal aesthetics as anything else.

Nowadays Phusion Passenger makes Rack-based Web apps snake-simple, and using JRuby gives me all of the Java libs out there (including Swing for insanely-easy cross-platform GUI apps when teamed with Monkeybars), as well the option to deploy Web apps as war files to Java app servers.

At this point the interest in Perl would have to be due to some intrinsic language feature that might help broaden your ideas about programming in general (the way that, say, Haskell or Io might).

On the one hand, I tend to think that learning a new language or tool kit is always a valuable experience. On the other hand I switched from Perl to Ruby as my go-to scripting language about 6 years ago and haven't felt like there were any niches which Perl serviced that Ruby failed to, for my uses.

Still, I'd say try it out for a few small things; you might find that Perl better fits the way you think, and if not, at least you can say you know a bit of Perl if anyone ever asks.

By and large, I've had the opposite problem making a lasting switch from Perl to Ruby.

I know Perl better than most other languages in my toolbox, and it's my default prototyping and one-off utility language. I don't find a lot of niches (for my typical uses, of course) that are served better by Ruby, so it's been really difficult to switch away from Perl.

My recommendation as a (mostly) Perl programmer is, learn AWK first if you are not familiar with it. If your line of work is mostly website development, it's probably better to stick with PHP and Ruby in my opinion.

Maybe look around CPAN a bit, see if you find any libraries that you think might be useful, and are not available on PHP or Ruby.

I like Perl. Given what you have said above it would be hard for me to say "Yes, give Perl a try" except to say "You should give Perl a try."

The reason I say that is because a programming language is just like a religion. You will like it or you will not (even with its quirks).

Personally if you're looking to learn another language I wouldn't bother with Perl. It's close enough to what you already know that you probably wont learn much [1]. You'll get more milage out of trying something like Smalltalk (Squeak is free and a decent environment) if you want to really learn OO inside out, Haskell if you want to learn functional (this will bend your mind for a while at first, don't give up!), Erlang could be interesting but very unlike most other things.

[1] You can probably learn things in Perl that you couldn't in PHP but if you pick a more pure language the lessons will stick out more. Perl also has a lot of extremely bad practices by default.

Well, if you are advanced with Ruby then you're probably set.

However, Perl is still an excellent language for building scalable web systems in no time.

With 'Modern Perl' you get 'Ruby on Rails' style of programming in Perl, and with Perl you get the tons of libraries in CPAN.

I wouldn't recommend learning Perl if you already know Ruby. For the same reason I wouldn't learn Python or Ruby because I know Perl. I'd learn something different like Erlang.

    With 'Modern Perl' you get 'Ruby on Rails' style of programming in Perl
What exactly does that mean? Optional parenthesis on method invocations? Considerable use of convention over configuration? Built-in object mapping to database schemas?
Optional parenthesis on method invocations? Yes, but that comes with Perl. (I don't find that even remotely useful. I like to know if a variable is calling a method or a member simply by looking at the code.)

Considerable use of convention over configuration? Not sure what you mean here.

Built-in object mapping to database schemas? Yes.

I'm also referring to the clean MVC/OO style project architecture.

Here's how I described it in another thread:

With modern Perl, code is usually clean and free of crazy syntax. With a OO architecture where the base classes do most of the work (such as auto authentication, auto encoding/decoding, auto DB joins, etc.) and you do business/game logic in the upper modules.

"With modern Perl, code is usually clean and free of crazy syntax. With a OO architecture where the base classes do most of the work (such as auto authentication, auto encoding/decoding, auto DB joins, etc.) and you do business/game logic in the upper modules."

Ah, OK. That just sounds like Ruby, though, nothing special to Rails about that.

Last time I checked, Rails provides a lot of built-in functionality for building web apps.

But perhaps I got Rails confused with Ruby with my brief experience with it. I thought Rails provided the tools to auto-create your project structure in an MVC style.

If you use something like Catalyst of CGI::Application you get built in things like MVC project structure, auto populate a 'class' from a table entry, etc.

Basically, you get all those built-in functionality for building web apps that you would in Rails. But, I very briefly played with Rails, so I may have its definition confused.

I see. So CGI::Application (and Catalyst) is a built-in part of modern Perl. Interesting.