extrafied99 has asked for the wisdom of the Perl Monks concerning the following question:

Perl has not been my only language, but it was the only one I've known well. I've learned some JavaScript.

My question is what language(s) should I learn that will help me build web apps, database apps, and desktop apps besides Perl, in which I can make an easy(ish) transition from Perl?

I'm sorry if this is a bit vague, but I just need a recommendation. Thanks in advance!

Replies are listed 'Best First'.
Re: What language should I learn?
by BrowserUk (Pope) on Jan 08, 2012 at 09:37 UTC
    in which I can make an easy(ish) transition from Perl?

    For something completely different, but which will improve your Perl in ways you never dreamed of and just might become a favorite for recreational programming, take a look at Pure

    This is not an "easy transition" in the sense that is it not 'perl with objects and nothing but objects'; or 'perl with bondage and only one way to do things'; or even 'perl without the sigils and memory management'. That is, you won't find yourself writing a perl program and then tweaking the syntax a bit to make it work in Pure. Pure is resolutely and unashamedly a Functional Programming language.

    But is will be an easy transition in the sense that it is a dynamic scripting language. So no huge compilers and endless compile&link phases; no static types disciplinarianisms, nor the need to take a degree course to work out who Church was. Add a number to a string, and if the string contains a number, that's cool.

    Just a simple edit/run development cycle with automatic memory management and useful error messages. And concise yet powerful code. As a teaser, here is a complete Sudoko solver written in Pure:

    * Sudoku example by Peter Bernschneider. */ /* This is an example Sudoku solver inspired by the Queens example whi +ch terminates in reasonable time. m1 is ZEIT-Online Sudoku of Dec 6th +2009. Interactive usage example: sudoku1 m1; */ using matrices; using system; m1 = {0,0,3,9,0,2,0,0,0; 0,0,0,0,0,0,2,3,1; 0,0,0,0,0,3,5,0,9; 5,8,0,0,0,0,0,0,0; 0,0,6,0,1,7,0,0,0; 7,2,1,4,5,0,0,0,0; 0,4,5,0,0,1,0,8,0; 0,3,9,7,0,0,6,0,0; 0,0,0,8,6,4,9,5,0}; m2 = {0,5,0,0,6,0,0,0,1; 0,0,4,8,0,0,0,7,0; 8,0,0,0,0,0,0,5,2; 2,0,0,0,5,7,0,3,0; 0,0,0,0,0,0,0,0,0; 0,3,0,6,9,0,0,0,5; 7,9,0,0,0,0,0,0,8; 0,1,0,0,0,6,5,0,0; 5,0,0,0,3,0,0,6,0}; sudoku1 m = take 1 (sudoku m); sudoku m = search (0,0) m; search (i,j) m = [m] if i>=9; = search (suc (i,j)) m if m!(i,j)~=0; = cat [ search (suc (i,j)) (set (i,j) n m) | n = 1..9; safe (i,j) n m ]; safe (i,j) n m = all (~=n) (row m i) && all (~=n) (col m j) && all (~=n) (sub (i,j) m); sub (i,j) m = m!!(spli (i div 3), spli (j div 3)); spli k = 3*k..3*k+2; set (i0,j0) n0 m = { if (i,j)==(i0,j0) then n0 else m!(i,j) | i=0..8; j=0..8 }; suc (i,j) = (i,j+1) if j+1<9; = (i+1,0) otherwise; __show__ x::matrix = strcat [printi j (x!(i,j))|i=0..8; j=0..8] + "\n" with printi 0 = sprintf "\n%1i"; printi _ = sprintf "%1i" end;

    It will make you think differently about programming, but that is all to the good. Even if it doesn't become a favourite for solving real world programming problems, a little exposure to FP will have good knock-on affects on the way you code in Perl. And Pure has the shallowest learning curve of any of the at least 10 FP languages I've looked at.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Re: What language should I learn?
by zwon (Abbot) on Jan 08, 2012 at 08:24 UTC

    I don't think that easy transition from Perl is a good criteria to look for a new language to learn. You should look for a language that would allow you to solve tasks you can't solve with Perl, or you can but not so efficient. Using this criteria I would recommend you to learn JavaScript, C, SQL, Erlang, Java.

      + +

      For some purposes, "ease of transition" may even be a bad criterion: the phrase seems to me to imply that one seeks a language with an inate similarity to Perl.

      For breadth of knowledge (and tools in your kit), perhaps one of zwon's picks... and perhaps also consider learning about the three basic (by one standard; there are others) types of programming languages: Procedural, Structured, and Object Oriented.

      Some of the other labels for distinguishing among languages include: Functional (with subclasses), Concurrent, and Event-Driven. And some CScientists still chose as their key distinction "Compiled vs Interpreted" (FWIW, Perl confounds many of these categorizations: For example, Procedural style is common -- and the community seems to lean toward "structural" style code as a best-practice, today; object-oriented style is also widely used; and when you get to "compiled vs. interpreted" you may start tearing your hair (if any) out.

      Can't resist: :-) -- so too will the distinctions reflected in http://en.wikipedia.org/wiki/List_of_programming_languages_by_category.

Re: What language should I learn?
by eyepopslikeamosquito (Bishop) on Jan 08, 2012 at 08:41 UTC

    My question is what language(s) should I learn that will help me build web apps, database apps, and desktop apps besides Perl, in which I can make an easy(ish) transition from Perl?
    Many/most languages can do those things. In terms of an easy transition from Perl, I suggest Python and Ruby.

    I'm sorry if this is a bit vague, but I just need a recommendation.
    Why? For example, is there something specific that you cannot get Perl to do? Or is it to improve your job prospects? Or is it something political in your workplace? Or something else?

Re: What language should I learn?
by chrestomanci (Priest) on Jan 08, 2012 at 09:41 UTC

    If you are looking to create better web or database apps, then the obvious suggestion is to learn SQL and know how to use it properly.

    I dare say you already know some simplified SQL from what you have done already, or perhaps you have used a translator such as SQL::Abstract (Used by DBIx::Class), but I think it is worth while to learn SQL properly so that you can gain a deeper understanding of what is going on, what it is possible to do with a database, and where the limitations lie. That way you will be able to code efficient database applications that don't have poor performance due to a bad query or database function.

    For desktop applications you have dozens of languages to choose from. Contrary to what others have said, I think Java is a good choice because it is cross platform. It is also the most popular language out there in the job vacancies, so if you are competent in Java you should not find yourself unemployed. Java is also the language of Hadoop which is making a big noise out there at the moment.

    If you just want to learn to improve yourself, then I think learning a functional language such as Haskel or Erlang would be good, because it is always good to learn a different paradigm, as it lets you see all your programming in a different light, and can improve your choice of algorithm and design.

Re: What language should I learn?
by ww (Archbishop) on Jan 08, 2012 at 02:43 UTC
    1. Enough about some DB (pick one and learn it in the raw; design, admin, operations) that you can leverage that when using the various DB modules.
    2. java's probably past its prime </trollbait> but so too is Assembler. Nonetheless, a background with (any) assembler -- going all the way back to RT11 or CP/M -- will force you to focus on practices and techniques. Those aren't directly transferable, in most cases, but they can help you with disciplines you'll need in many languages... including, most likely, those that aren't even well-known, widely-used... or even, written, yet.

    But really, learning any additional language well is -- IM(not so)HO likely to be beneficial.

    Updated: added last para; clarified my intent re databases.

      +1 for learning databases, or at least advanced-ish SQL. It's a nice feeling you get when you reach that levelup. Having a pet project is probably the best way to go about that.

Re: What language should I learn?
by Anonymous Monk on Jan 08, 2012 at 01:05 UTC

    I've learned some JavaScript.

    Great, next you should learn JavaScript the good parts

    Like you can write bad perl, you can also write Modern Perl, and the same applies to javascript. Crockford teaches you how to write javascript the best possible way

    • http://javascript.crockford.com/
    • http://jslint.com/
    • http://www.json.org/
    • http://www.adsafe.org/
    • http://jquery.com/
Re: What language should I learn?
by tobyink (Canon) on Jan 08, 2012 at 10:09 UTC

    For web apps and database apps, I'd say PHP. PHP gets a bit of a bad reputation. For many coders it is the first language they learn, and often the only language they learn, so there's an awful lot of bad PHP code out there written by people with no formal training in programming. That's largely why it has a poor reputation.

    But recent versions of PHP have had pretty good object-oriented programming support (its OO system is quite Java-like, supporting only single inheritance, with abstract classes and interfaces, and in the latest release candidates traits too), namespaces, a unified database interface (PDO). PHP supports Perl-compatible regular expressions. And PHP's syntax should be fairly familiar to Perl programmers, as its original designer was a Perl scripter. (IIRC PHP 1.0 was implemented in Perl, but newer versions are implemented in C.)

    Weak points are the lack of an LWP::UserAgent equivalent (PHP has various different HTTP client libraries, but they're universally rubbish) and lack of something like CPAN (there is PEAR/PECL, but it it has a much smaller set of libraries available, and many are very poorly documented). Also, while there do exist some PHP extensions for desktop programming (e.g. PHP-GTK) they're not especially mature. PHP is not the language you want to use for desktop programming projects.

    Python (like Perl) is a bit of an all-rounder. It's certainly suitable for web apps, database apps and desktop apps, though I find certain things about it quite infuriating. One factor that seems to irk a lot of people (including myself) is that whitespace is considered significant. An "if" block indented by 6 spaces might have a different meaning to an "if" block indented 4 characters, depending on the indentation of surrounding code.

    Ruby is very Perl-like in many ways. However, it lacks Perl's breadth and maturity in libraries.

    That said, a better learning experience might be to try learning some programming languages as un-Perl-like as possible. Once that use completely different programming paradigms. That way, when you come back to Perl, you can apply ideas you've learnt to your Perl programming. Learn a functional programming language like Haskell or Miranda; learn a declarative programming language like Prolog. Learning a very different language could help you become a much better Perl programmer.

Re: What language should I learn?
by luis.roca (Deacon) on Jan 08, 2012 at 02:26 UTC

    Ruby — and I would highly recommend the following to start:

    Good luck.

    "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." — Don Quixote
Re: What language should I learn?
by ikegami (Pope) on Jan 08, 2012 at 02:40 UTC

    in which I can make an easy(ish) transition from Perl?

    To me, that means a language in which I wouldn't constantly run up against limits Perl doesn't have. That rules out C, C++, Java, Basic and maybe PHP.

    Languages similar to Perl5 include Perl6, Python and Ruby (in no particular order), but I don't know any of them.

Re: What language should I learn?
by CountZero (Bishop) on Jan 08, 2012 at 12:36 UTC
    I think this is the ideal moment, not to learn a new programming language, but to study computer science.

    This will make you better understand the basics of programming, how to write efficient code (and even think about what "efficient" means), learn about the many programming paradigms (procedural, functional, object-oriented, logical, ...) that exist and when/where best to apply them, study the fundamental algorithms, ...

    You will see that this will enormously enrich your knowledge and make you a "better" programmer. It will even allow you to answer your own question what language to learn next.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: What language should I learn?
by cavac (Curate) on Jan 08, 2012 at 16:19 UTC

    C is quite (but not entirely) unlike Perl. You may not have to learn all the little details, but learning enough to write some minimal code wrapper is a good idea.

    When you're coding on a regular basis, sooner or later you'll come across some half-arsed hardware you want to access (either because it's cool or your boss tells you so) and the only "easy" way is to write an XS wrapper for the propritary library that came with it. If you know a little C, it's not that hard - you'll have to struggle with MakeMaker for a few hours, but it wont be that hard to accomplish.

    ...that reminds me: note to $self: i still have to deliver on the promise to write a simple step-by-step Meditation on how to actually do this...

    Learning SQL is also a very good, non-exclusive choice. It will help you quite a lot when dealing with large, complex sets of data.

    Believe it or not, using databases is also quite fun... can't believe i just said that, maybe it's nearly time to go on vacation and do another bicycle trip?

    This message was brought to you by the Acme Monks Corporation. This message may explode at any time.
      C is quite (but not entirely) unlike Perl.
      While I agree that C is a very useful language to have knowledge about, I disagree that C is unlike Perl. Perl is much more C than people think. I'd go even so far that without having some C knowledge, you will wonder why Perl does do certain things till the day you die. Learn C, if not to program in, then to make one a better Perl programmer. (If C is portable assembler, Perl is portable C).
Re: What language should I learn?
by InfiniteSilence (Curate) on Jan 08, 2012 at 22:30 UTC

    This is just too broad/vague a question. It is like going to college and, without providing any information about yourself, your interests, and your prospects, blindly asking what your major should be in. If this is how you approach things in life you are simply asking for failure.

    What tool you use has everything to do with what you are trying to accomplish. Different tools are useful for different problems and computing is no different. You must start with a class of problems and spend time, energy, and thought power toward learning popular and effective solutions (if they exist) to that problem. For instance, if you were a statistician and the only language you knew was the one for the R system you would likely be employable. I once worked with a developer whose only language was assembly, but he was creating advanced embedded control systems for computerized high-end telescopes and exceedingly happy doing so. Choose the right tool for the right job.

    Celebrate Intellectual Diversity

Re: What language should I learn?
by TJPride (Pilgrim) on Jan 08, 2012 at 03:35 UTC
    Perl -can- do just about anything, but its strengths lie in code density and ease of use in the areas of regex and manipulation of complex data structures. If a project doesn't cater to those particular strengths, you can just as well solve it with any popular high-level language. I'd personally start with PHP next, not because it's necessarily the best, but because it has by far the most market share, with some 77% of the web. PHP is also relatively simple to learn.
Re: What language should I learn?
by Jenda (Abbot) on Jan 08, 2012 at 15:44 UTC

    Depends a lot on the operating system(s) you expect to need the apps to run at. I would not say the transition from Perl is easy, but C# is finally worth looking at after the addition of generics, lambdas, anonymous types, extension methods and rudimentary type inference.

    Shame there's a lot of cruft in the libraries from the old times. Especially the lack of generic types at the time the libraries were designed forced lots of "suboptimal" decisions. So they force you to typecast where there should be no need to, they force you to implement arcane interfaces where a simple lambda would be much more convenient, ...

    And the Roslyn project that'll let you hook into the compilation process looks quite interesting.

    Enoch was right!
    Enjoy the last years of Rome.

      Aside from that C# is a modern and flexible language you might also get to to choose it, or another .NET language for that matter, because of .NET's solid ASP.NET MVC or ADO.NET frameworks

      Especially the lack of generic types
      generics might be good for most occasions but they cannot do math, so you either have to rely to trickery or,ironicaly, to the dymanic type!

      Another criteria for choosing a language is if you can forsee if it will last against time, something that Perl has proven, while you can never be sure with Microsoft.
      There is even talk of Dumping .NET and its managed environment as a whole and go back to native code and C++ !

      ++ for the Roslyn link

        The linked article, while quite interesting and certainly at least partly true, does make some weird statements.

        To be clear HTML/JavaScript is unproven technology.

        Huh... what?!? This August 2011 Web Server Survey found nearly two hundred million active sites running different webservers. That tells me that at least HTTP and HTML are used by millions of people. And this statistics page know of at least 1,659,185 sites using Javascript.

        It may be relatively unproven technology for Microsoft, since - for the longest time - they brewed their own soup called "Internet Explorer 6". But in the last few years they gotten rather good at adhering basic standards.

        If the future of Windows apps is HTML5/JavaScript then Windows has no future.

        What the...? At the time of writing this node, there is a whole caboodle of spezialized hard- and software that only runs on windows which will probably take decades to replace. Microsoft's market share may drop in the regard of "number of windows installation" or they may not. On the other hand, in respect to gaming and office solutions they are a strong contender - especially if they really start pushing HTML/Javascript based SaaS.

        As for the notion that client-side operating system choice will get more and more irrelevant: Yes, i hope so. That's why i try to develop everyone of my projects when possible as a web based tool. It saves in continuous porting to different operating systems - and leaves the user a choice, because all (s)he needs is a HTML compatible browser. The application doesn't limit the user preference on the prefered operating system anymore, and i don't have to care either.

        Whatever is really going to happen, the next few years will be interesting.

        "Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid… and I went ahead anyway." (Crow in "MST3K The Movie")

        ADO.Net itself was a big step ... in the wrong direction. LINQ to SQL and Entity Framework/LINQ to Entities may use some part of the ADO.Net libraries internally, but thanks god give you a saner API.

        I don't understand what do you mean by your "generics might be good for most occasions but they cannot do math".

        The article sounds hugely exaggerated. C# ain't going anywhere any time soon. See eg. Building your first Windows Metro style app using C#, C++, or Visual Basic

        See? WinForms are gone, WPF is gone, but the language under the UI may still be C#.

        Enoch was right!
        Enjoy the last years of Rome.

Re: What language should I learn? (and We've Narrowed the Choices Down to?)
by Anonymous Monk on Jan 08, 2012 at 18:38 UTC

    Well it looks like your options have been narrowed down to: (in order of appearance)

    • javascript
    • Ruby
    • Perl 6
    • Python
    • Java
    • Assembler(?!?!), including RT11 and CP/M
    • SQL
    • PHP
    • C
    • Erlang
    • Pure
    • Haskell
    • C#
    • .Net
    • C++
    Now that _that's_ settled it looks like you have a clear choice ;-))

    (As eyespoplikemosquito stated earlier in his post) You're going to have a tough time choosing via informal survey without having a clearer idea of what you want. Is this purely for education? Is it for for a project? Work, career? What languages do people know at work, school or local groups?

    That will inform your decision more but you will still have to pick a few of theses languages (out of a hat if you have to) and take them for a spin over a few weekend.

Re: What language should I learn?
by Anonymous Monk on Jan 09, 2012 at 03:47 UTC
    “How do I transition away from using a hammer?” inquired the master craftsman, as his apprentices looked upon him very strangely.   A programming language ... any programming language ... is a tool, nothing more or less.   You should make it your business to constantly learn about more such tools, because, ummmm, it is your business.