http://qs321.pair.com?node_id=187006

Although "learning Perl" comes up occasionally for discussion, learning Perl as a first language comes up less frequently and I was wanting to learn of other people's experiences on the issue. I'm occasionally approached by individuals who have never indulged in the bittersweet area of computer programming, but people who nonetheless want to try the forbidden fruit of coding. These are people who want to learn programming on their own for their own perfectly legitimate reasons (it usually has something to do with game programming). My old suggestion was to start him or her on Visual Basic (mentioning that blasphemous word in a post will certainly get me some down-votes). But just to test an insane idea, I recently suggested that someone tackle Perl as a first language and the results were incredible. He learned the language quickly and actually wrote a simple text parsing program in perl that he was able to use on his job. I realize there are many variables that contribute to how well someone will learn programming in general (ambition, previous experiences, etc) no matter what language he or she starts with, but I was still surprised at how fast he learned perl and at the same time learned some of the important concepts of programming (variables, looping, conditionals, etc). I have heard from many sources that Perl is not a good starting language and that many beginners have problems coding in it. I never have found that easy to believe, but I still see that mentality surface all the time.

Please allow me digress for a moment (you can skip this paragraph if you have a low tolerance for too much information). Before I start getting responses on why I'm recommending Perl or that other language for someone interested in game programming, please allow me to say that if someone needs something with a little more pizzazz than a "level designer" for a game to satisfy their craving for game creation, I would recommend c/c++. But it just doesn't feel right recommending c/c++ as a first language (although I have been guilty of that more than once with less than dramatic results so I've had to modify my approach.) My idea is to suggest a beginning language that allows someone to learn some of the basic concepts of programming and then hopefully move on to c/c++ later in the game (npi).

My question is how easy is it for someone to learn programming by learning Perl as a first language? What are your personal experiences if you've started with Perl, or how well have others around you learned Perl as a first language? If you don't think perl is the best language to start off with, what language(s) would you recommend for a beginner. For the record, Perl is the 4th language that I’ve used on an ongoing basis. I’ve tinkered with countless other languages though.

Replies are listed 'Best First'.
Re: Learning Perl as a First (programming) language
by crenz (Priest) on Aug 02, 2002 at 07:07 UTC

    Wow -- what a nice topic.

    Personally, I think that Perl is very suitable as a first language. Some reasons come to mind:

    • You don't have to trouble yourself with the difference between numbers, characters and strings (like e.g. in Java, Pascal, C)
    • Easy development environment -- a friend can just point you to a perl-highlighting editor and show you how to configure it to run perl. No need to learn a complex IDE. Plus short turn-around times.
    • Perl doesn't bug you with header files, libraries etc. (at least not in the beginning)
    • Type designations ($, @, %) help the beginner to remember what he is doing without having to learn Hungarian Notation ;-)
    • The human language considerations make easy perl quite understandable -- I think open or die is understood better than try {} catch{}, for example.
    • Perl's syntax is very complex -- but you only need a small subset to get going.
    • Perl has enough complexity to keep you going forever (unlike VB or Pascal)
    • There are a lot of applications -- Text manipulation, CGI etc. -- that help you to apply what you learn

    In fact, the last point was the most important one for me. I got a perl book some years ago, but I started to do real programming only a few months after I got the book -- when I had a real CGI problem to solve. Of course, this is how we get all the insecure guestbooks etc., but hey, everybody starts out some time.

    Beginners or not-so-advanced programmers might be freaked out by regular expressions, cryptish code, JAPHs etc. But you can actually learn the concept behing regexes very quickly (although it takes time to understand their limitations thoroughly!), and you can write good software in perl for years without using heavy syntactic sugar once.

    Basically, perl allows you to choose the level where you want to be. Some people are comfortable at a more formal level. Others are more adventurous. Perl accomodates both.

    All this leads me to the next question -- what would you consider good materials to teach beginners a usable subset of perl?

Re: Learning Perl as a First (programming) language
by mkmcconn (Chaplain) on Aug 02, 2002 at 09:24 UTC

    My first programming "language" was DOS batch files. I stuck with that for a long time, charmed by how much can be done with so little. I looked to Perl when I was called upon to do some "real" programming, a couple of years ago, and then only because I was given a choice to use either Perl or Python. When I chose Perl as my first "real" language, it was the community that I chose, rather than the language per se. I knew that what I really needed was more than just a correct way to talk to a computer.

    There are basic concepts that continue to be a struggle for me to grasp, even after over two years of using Perl almost every day. Perhaps I still have DOS customs, habitually looking for the ten-thousandth use of the foreach loop. But, the little bit I learn from any language I dabble in, I bring back to my use of Perl. That is the point I want to expand.

    What I have in Perl first of all is a true ecclectic culture; and that is its greatest asset. I know that wasn't the first thing that came to mind, when you asked your question; but, it is the first reason that I would recommend Perl as a "first language". It is very perlish to love and even favor other languages. All around the Monastery, you'll hear Perl spoken with accents of Smalltalk and VB, lisp and bash, C and awk, caml and Delphi, algebra and gymnastics, theology and soup-chefery. These are not foreign accents. They each add to the richness of Perl, and in turn open a programmer-wannabe outward to the bigger world and all the branching diversity of ways that people are working to make the Machine more clever. Perl celebrates the frenetic world-genius that has brought forth all this buzz and chatter, and it is itself a faithful embodiment of that useful noise.

    If other languages are like the buildings and the classrooms of a college, Perl is like the University experience, in which patterns of diverse learning begin to converge, where the joy of what you learn from all the lectures is discovered.

    Perl is a good learning language because, it's a language that never stops learning.
    mkmcconn

Re: Learning Perl as a First (programming) language
by PetaMem (Priest) on Aug 02, 2002 at 08:58 UTC
    Hello,

    What are your personal experiences if you've started with Perl, or how well have others around you learned Perl as a first language?

    I personally started with perl in 1996 after having tried C++ (which came after C, which came after GFA-Basic). Even if I put aside the encounters with in-school programming languages such as Scheme, CL, ML, Pascal I could say, that I found Perl in a phase of mine, where my programming skills were - well - skilled.

    What I can make statements about, is now the aproach of some employees here that also started with perl a few months ago. All of them had one or another programming experience in general and some programming languages knowledge as such.

    The most interesting facts are:

    • I think that the high idiomatic richness of perl has sharpened my point of view "how to do it" in a way that the TMTOWTDI type of thinking opened "new pathways" in my brain. I think perl helped me to improve my programming skills in general by offering constructs that seem to fit more of a natural thinking (instead of the formalized thinking of the more low level languages).
    • But we were talking about beginners: So I am very carefully watching the colleagues learning perl. My observation is, that when an average - but ambitious - programmer is confronted with perl AND if he is forced to have GOOD results in his code, he will go through a major change in his type of problem solving and he will of course encounter far too many ways of how to do it.
      Yes - in general a programmer wishing to harness most (if not full) of the power of Perl will soon see, that he needs to learn a damn lot more than he already knows.
    • I don't have any experience with first-time programmers starting with perl, but according to my experience it absolutedly cannot hurt. Why? Because even the fresh perl code generated by programmers already keen in some programming arts, looks in the first iterations like some kind of perl-basic.
    So my conclusion is: Perl is absolutedly suitable as first-to-learn-language, as long as the programmer is aware of the many refactoring iterations his software will have to go through.

    Bye
     PetaMem

Re: Learning Perl as a First (programming) language
by Abigail-II (Bishop) on Aug 02, 2002 at 12:10 UTC
    I think Perl is not a good first language. Sure, there might be a few successes, but just go read comp.lang.perl.misc for a month and see how often and horribly it can go wrong.

    Perl is a powerful, but dangerous language. We don't learn people how to drive using a Ferrari, people don't learn to fly in an F-16 jet, nor do people learn how to read using Shakespeares plays. Why should computer languages be any different? It's good to have training wheels. Many language IMO are much more suited to learn programming. To name a few: Pascal, Python, Java, and Haskell. Probably Eiffel as well.

    Perl is not suitable for everyone. In fact, I believe that more than 75% of the people currently using Perl should be using a different language (or maybe not even program at all). Using Perl as a first language only increases the number of bad programmers, further clogs forums like comp.lang.perl.misc and contributes to the bad name Perl already has.

    Abigail

      I agree with you that comp.lang.perl.misc is a bit of a junkyard. It's where programmers who have tried to force their way up the Perl learning curve can post their messes instead of buckling down and doing some reading and hard work.

      But I believe Perl is easy to learn because Perl does little things for you like allow you to enter

      for ( $i=0; $i<10; $i++ ) { print "$i"; }
      and get it up and running in no time. Sure, you get '0123456789' as the output, but there were no include files, no compiler or linker to deal with, and no memory management or window management to worry about.

      Perl is a very elegant language, but it can also be really gross (e.g., obsfucations) -- but that's OK, at least it's flexible. I programmed in Pascal for a while and wasn't really thrilled every time I had to cast a char to an integer in order to do some math with it, then cast it back to a char. Ugh. Or deal with the nervous nelly compiler errors.

      I really can't imagine starting with Java -- it's not my idea of a lightweight language. I find it rather dense, and I spent many years programming in C. Even starting with an OO language is a bit of a jump -- I expect that people want to jump right in and start trying things. Writing clean, Object Oriented code can come later.

      I don't think Perl has a bad name -- it has a pretty good reputation. Sure, it may be hard to learn, but then :) I'll take that any day over something as trivial as Pascal.

      --t. alex

      "Mud, mud, glorious mud. Nothing quite like it for cooling the blood!"
      --Michael Flanders and Donald Swann

        I'm not impressed by your example of doing little things. Even in C (which I don't recommend as a first language), it's easy to do - in fact, it translates almost token for token. It's like saying a Ferrari is a good car to learn driving with because it's easy to turn on the headlights.

        You say that Java isn't your idea of a lightweight language. I don't disagree with that, but hopefully you aren't suggesting that Perl is. Perl is far from being lightweight language, in all aspects. It has a syntax hardly anyone, including wizards with more than five years of experience, can fully remember, and it has a very wide range of primitives. I doubt there's a language with a significant user base out there that has such a complex function to open a file. It was only yesterday that on perlmonks people were confused about 1-arg open.

        Abigail

        If you are going to explain how Perl lets you learn, why don't you show that in the form that beginning programmers should learn?
        for my $i (0..9) { print $i; }
        Less mechanics to remember, and no possible confusion over off by one errors. Or even in this case (depending on which way the example was going to develop) just:
        print 0..9;
        Either of these is more convincing than writing Perl like a C refugee.
      I think English is not a good first language. Sure, there might be a few successes, but just go read any usenet group for a month and see how often and horribly it can go wrong.

      English is a powerful, but dangerous language. We don't learn people how to drive using a Ferrari, people don't learn to fly in an F-16 jet, nor do people learn programming by implementing machine translation systems. Why should natural languages be any different? It's good to have training wheels. Many language IMO are much more suited to learn a language. To name a few: Latin, Classical Greek and Hebrew. Probably Classical Chinese as well.

      English is not suitable for everyone. In fact, I believe that more than 75% of the people currently speaking English should be using a different language (or maybe not even speak at all). Using English as a first language only increases the number of bad English speakers, further clogs forums like comp.lang.perl.misc and contributes to the bad name Perl already has.

      Hanamaki
        It's a good thought, but english is a bloody confusing language. Much more so then other 'romance' languages and derivatives, as english's 'syntax' is semi-random and it takes years of speaking it to even get close to being fluent.
Re: Learning Perl as a First (programming) language
by oakbox (Chaplain) on Aug 02, 2002 at 07:51 UTC
    Aside from some very BASIC programming in grade school, Perl was my first language. The motivation was to build some form handlers for a web site I wanted to put together. From personal experience, I can say that Perl is very easy to pick up, you can start writing USEFUL programs almost immediately, the community support (here and on other sites) is outstanding, Perl is available on virtually every operating system/environment, the learning curve is shallow but VERY long (there's always One More Thing to pick up), and, as mentioned above, it's very forgiving.

    Having said all of that, it IS a bit difficult to hop down to a low-level language. But, as you advance in Perl, you start moving closer and closer to C, object-oriented programming, attributes, etc. etc. etc.

    Most texts try to introduce you to Perl as if you are coming from a different language. I would like to see some texts going the other way!

    oakbox

Re: Learning Perl as a First (programming) language
by BUU (Prior) on Aug 02, 2002 at 07:23 UTC
    Heh, to me, the best answer is that it really depends on what your attempting to do. If all your trying to do is automate some processes and what not, sure, learn perl, learning c++ first would just be a waste. However, if you are interested in more advanced stuff, like eventual game programming, learning perl as a first language will drive you insane when you 'move on' to c/c++. You end up spending the entire first year going 'What the hell, i have to write 4 different functions for 4 different variable configs' or 'i have to write 2 different functions for a string or a number?' or ' i have to write my own conversion for num to string' and various other details that are, in general, a pain in the ass. However, they are even more of a pain in the ass when you come from a language like perl, that has a huge DWIM thing going on, as opposed to c/C++'s 'Do Exactly What The Syntax Tells You To'.

    Perl, on the whole, is probably much easier for 'non programmers' to learn, partly because its such a forgiving language (auto garbage collection, catchall vars, etc) partly b/c of the roots in lingustics (as everyone loves to point out), but once you learn it, you get spoiled, and moving to a very low level language can be some what of a.. shock.

    Of course, it helps to use low level languages to do what theyre designed for, such as very fast graphics and drawing routines, as opposed to trying to write a program that adds up employees salarys and so forth, which is A) what most courses assign as problems and B) much more suited to a high level program. I.e., "if you can do it in one line of perl, you probably should".
(jeffa) Re: Learning Perl as a First (programming) language
by jeffa (Bishop) on Aug 02, 2002 at 14:49 UTC
    I worked with BASIC, C++, Java, 8086 assembly, architecture, Yacc/Lex, Concurrent Pascal, COBOL (shudder), and VB6 before i really starting using Perl. I was very slow at grokking Perl, but now that i have fairly good knowledge of the language, i feel that other languages (except Lisp and Scheme) are a piece of cake. Programming itself is still hard though. :)

    I have always believed that Perl is just not a good first language to start with, but that really depends on the person learning. Some people just have a better understanding of problem solving than others. For example, when i worked at the unnamed Microsoft shop coding VB, one of my peers (who was older, but very green) asked me to come up with a small project for him while he studied for his certification. I suggested a calculator program with a GUI - after all, VB makes GUI's a breeze. I was not surprised to see that his code did not make use of an array for the buttons. Instead he had assigned each button to variables like Button1, Button2, etc.

    What i was surprised to see, was his cubicle-mate, who was studying to be a project manager. This guy had no real programming experience either, but had decided that he was tired of studying manager-type material and wanted to have a go at a calculator. He had used an array - instinctively. Two years later maverick and myself visited the office just to say hello. I was again surprised to see the second co-worker reading a Perl book. :)

    I guess the best way to introduce someone to programming is to give them a tour of the different languages and let them decided which one(s) they want to program in. If they don't like any of them, they probably don't like programming. If they choose Lisp, leave 'em alone! ;)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Learning Perl as a First (programming) language
by weini (Friar) on Aug 02, 2002 at 12:25 UTC
    Like oakbox I had very little BASIC experience and started learning Perl as my first programming language - just for the fun of it. I've read danger's "Elements of Programming with Perl" and it was a very useful introduction to both, programming and Perl.

    After reading the first perl-related usenet-groups I realized a very friendly community and a fascinating spirit of the perl programming language. Meanwhile we have the Monastery - what else there is to say? Beginners get superb support, not to mention the great online documentation of Perl and it's modules and really good books for all levels.

    As an amateur I still have problems switching from structural to object orientated programming though. But that's a matter of practise, I guess.

    I would encourage anyone to learn Perl. It's easy to begin and yet impossible to end.

    weini

Re: Learning Perl as a First (programming) language
by FoxtrotUniform (Prior) on Aug 02, 2002 at 16:39 UTC

    I think that Perl's a horrible choice for a programmer's first language: it does too much for you. The Perl hacker doesn't have to worry about buffer lengths, array bounds, keeping track of allocated memory, and so on, which makes it easy to develop habits that don't address resource allocation. Fine if you're hacking Perl, not so fine if you start writing C later on.

    I have some personal experience to back this up, if you'll indulge me. I've TAed labs for an introductory software engineering course at my university: this is a student's first introduction to writing software, rather than using a procedural language. It's also their first glimpse of C. For a long time, the first-year courses were taught in Pascal; recently, they switched to Java. Students who learned to program with Java had much more trouble keeping track of resources (file handles and heap memory, for the purposes of this course) than the ones who started out with Pascal, and their code was brittle as a result. I attribute this to Java's "convenience" features (growable strings, garbage collection, etc).

    The problem with teaching programmers Perl as a first language is that they will almost inevitably go on to write C, and their C will be buggy and insecure. I'd like to see Comp. Sci. majors around the planet start with an elegant, sane assembly language (MIPS and 68000 asms come closest to this ideal, IME), then move to C, then move to safer, higher-level languages. Like Perl.

    On the other hand, Perl makes an excellent first language for people who aren't going to be career programmers: it's easy to get a lot done with only a little knowledge, which means less lag time between starting to program and solving your problems.

    --
    The hell with paco, vote for Erudil!
    :wq

      On the other hand, Perl makes an excellent first language for people who aren't going to be career programmers: it's easy to get a lot done with only a little knowledge, which means less lag time between starting to program and solving your problems.

      Thanks for making this distinction. I run a very small website that has to search a database of texts for its output, and then put that into an encoding that the user of the site can choose (there are different ASCII transcription schemes available for Ancient Greek that are alternatives when unicode support is not available).

      Perl enabled me to get this site up and running in a very short time. I'll never be a career programmer ("It is ... too late for me." -DV), but I'm very glad that Perl was out there. I've made a lot of stupid programming mistakes to begin with, but I'm learning, and I'm still interested. That's more than I can say about trying to learn Z-80 assembly language when I was 10. That put me off programming for a couple of decades.

      BCE
      --Your punctuation skills are insufficient!

      On the other hand, Perl makes an excellent first language for people who aren't going to be career programmers: it's easy to get a lot done with only a little knowledge, which means less lag time between starting to program and solving your problems.

      Like BorgCopyeditor, I realize this statement describes my relationship with Perl clearly and succinctly. I am not a career programmer. Rather, I stay on the fringes of programming: Oracle DBA training and consulting. Up until the past few months, I've basically read about Perl, written a few little utilities to help with my work and browsed Perl related websites.

      Although I can read code in many languages, and have been through the first few chapters of some of the Learn <language> in 24 hours, Perl is the first language in which I've written a useful application for my clients.

      I find Perl to be challenging and useful. I seriously doubt it will ever cease to challenge me. I know it will never cease to be useful for me.

      Perl as a very first programming language? With my exposure to other languages, I didn't consider myself completely green, although through exploring Perl, I've learned more about other languages. Should I start my children off with Perl? I think I just might... In a few years, they'll be teaching me!

      -Daruma
Re: Learning Perl as a First (programming) language
by cybear (Monk) on Aug 02, 2002 at 12:48 UTC
    Perl is an excellent first language.

    My primary reason for this is that you can benifit from PERL
    nearly instantly. Writing simple utility scripts that move
    files around, search for meaningful bits of data on your HD,
    and may other manual processes are easily converted to PERL.

    Abigail-II does have a point. PERL is a very powerful language,
    and new comers should be very wary of using it. If you are going
    to try anything that effects your system, in other words, things
    that would change something already in use on your system, you
    should back everything up, use strict, use -w, and test the
    H - E - double hockey sticks out of it before using it for real.

    However, this is another advantage of PERL. It is very east to test
    one piece at a time. Since you don't have to write, error-check, and
    compile you programs before testing them you can proceed one step at
    a time. This makes PERL an ideal language for new comers.

    Personally, I was turned off by Pascal and C/C++ because in order to get
    much use from it you had to learn a great deal FIRST. I am not that
    patient. With PERL I was able that helped my out, on my job and at home,
    within one hour of starting "Learning PERL" by O'Reiley.

      And for your first lesson: it's Perl or perl, but never PERL.

      KTHNX.

        I know this is off-topic, but.. I have always wondered about why we're not allowed to say PERL. After all, Perl stands for Practical Extraction and Report Language? So why not PERL?
Re: Learning Perl as a First (programming) language
by Bird (Pilgrim) on Aug 02, 2002 at 15:15 UTC
    Personally, Perl was not my first language, so I can't speak to that. What I have run into is someone who, having heard the many wonders of Perl as it relates to other popular languages (C, C++, Java), chose not to learn Perl, but rather to keep it in mind as an ultimate destination.

    Admittedly, this person comes from a shell scripting background. Concepts such as variables and looping are not new to him. He had no experience with pointers, memory management, design methodology (procedural, functional, oop), so when I would explain to him why Perl's scalar, array, and hash variable types were so cool, he had no reference point for how painful it could be to implement the same functionality that these provide in a language like C. He chose not to gloss over what seemed to him to be necessary fundamentals by learning Perl first. Instead he is learning C as it relates to system architecture and internals. He has every intention of learning Perl eventually, but would like to learn a lower-level language first so he can understand just how much he's gaining (or losing) when using Perl.

    I feel that neither Perl nor C are very good first languages. Both use some very abstract concepts that I think are better learned after you've got the basics of variable types, looping, branching, etc. down. Yes, I think even Perl's wonderful scalar variables are too abstract for a beginner. Understanding how the system stores your data is critical to becoming a good programmer, and Perl tends to make things like that just a little too easy to ignore.

    -Bird

/using/ perl as a first programming language (was Re: Learning Perl as a First (programming) language)
by aufrank (Pilgrim) on Aug 02, 2002 at 16:49 UTC
    hey all--

    Perl is not the first programming language I've learned, but it's the firts programming language I've used. I can't comment honestly on what it's like to learn perl as a first language, as I started with logo as a kid and then took a high school class in basic and a college intro in java. I came into perl with a good handle on things like loops, scoping (though our still throws me sometimes), and modularization.

    perl, however, is the first programming language that I've actually used to program. Other languages may have taught me those general concepts (and how to move a turtle around the screen), but perl made it possible to implement those concepts in ways that made sense to me, and were as flexible as my thinking. Granted, I still write some pretty ugly code, but I also feel like a programmer rather than a casual user or an unskilled novice. Sure there's a lot of stuff I could do better and a lot of functionality in perl that I am blissfully unaware of, but I have what I need to allow me to do things in the programming language rather than just come up with stock answers to class assignments or make unsuccessful attempts at implementing interesting concepts.

    I blame my current sense of accomplishment and my growing fascination with the art of programming on perl, because perl is the first language that has made me recognize the extent to which programming can be an art[1]. With its relatively shallow learning curve (at least for someone with decent math, and hopefully some exposure to logic and/or programming), its natural-seeming syntax, its extensive documentation, its amazing extensions and its fantastic communities, perl has turned me from a pretender into a striver. Before I played at competency, convincing myself that surely I could hack something together if I really had to; now I understand my own capabilities, and even when I can find an answer, I know that I am best served by seeking out another WTDI.

    and what do I get at the end of this gush? I just looked down at the Llama and realized why it is that even if perl is not the best first language to learn, it is the best first language to program in. It's one of the basic commitments of perl as a language; what I just used all these words to try to say, the perl community has built itself around:

    Perl makes the easy things easy and the hard things possible

    just another perl monk
    --au

    [1]Apparently Lisp is good for this too and, especially after reading GEB, I am eager to explore functional programming.

Re: Learning Perl as a First (programming) language
by sauoq (Abbot) on Aug 02, 2002 at 21:25 UTC
    I don't think Perl is a bad first programming language to learn but I don't think it's a great language for learning programming.

    Perl provides some instant gratification and that's encouraging for people just being introduced to programming in general. On the other hand, Perl hides many of the details to which new programmers should get some exposure. As unpopular an answer as this might be, I think Pascal is a good language for learning programming. The first design goal Wirth set for Pascal was:

    "to make available a language suitable for teaching programming as a systematic discipline based on fundamental concepts clearly and naturally reflected by the language"1
    I think the language successfully met that goal. Pascal provides a gentle introduction to important concepts like pointers, memory management, data structures and abstraction, and structured programming.

    I learned BASIC first (and found its instant gratification encouraging,) then some assembly for the 6809. Then I learned Pascal and it helped me better understand what I already knew and gave me a good foundation. After that, C came pretty easy.

    Lisp hit me with many new concepts, particularly about algorithms. I think it would make a good first language in many respects. It's beautiful and syntactically minimal. I understand MIT uses scheme in its introductory courses. Now, many schools are teaching C++ first. I think that's horrid. I use OOP despite the fact that I was introduced to it through C++. If I had to choose between recommending C++ or Perl as a first language, Perl would win hands down.

    1 ISO 10206:1990 "Extended Pascal"

    -sauoq
    "My two cents aren't worth a dime.";
    
Re: Learning Perl as a First (programming) language
by Spenser (Friar) on Aug 02, 2002 at 22:11 UTC

    I didn't start with Perl, but it is the first programming language that I have learned successfully.  Of course, one could say that my failed attempts in other languages and my exposure to Access development contributed to my learning and understanding of programming and thereby prepared me for Perl.  I would have to agree with that. However, the most I did before Perl, was to make minor modifications to programs others had written in a variety of languages.  I did write very basic programs in BASIC and COBOL in college many years ago, but I would call them meaningless exercises and not true programs.  I also developed a bit with Microsoft applications such as Access.  My attempts at true programming were with VB and a couple other such non-sensical languages that rendered much frustration and no finished programs.

    So I did know a little of the fundamentals of programming before starting with Perl, but I think if I had started with Perl I would have learned to program sooner.  It was not until I began learning Perl that everything came together for me.  Now, with Perl I can start with a blank page in my text editor and envision the commands and functions and create something.  I never was able to accomplish that with any other language.  Perl is more of a natural language (Larry Wall, et al) and therefore fits well into the internal program in my head that drives languages, spoken human languages.  If a computer language like VB can't fit into the neural system that manages language communication--VB is more of a scatter brain type arrangement to my mind--then I must memorize rather than learn the computer language.  That is the difference I see with trying to learn that which is not learnable but requires memorization like VB and learning that which is natural and learnable like Perl, especially when starting out.  But, maybe I'm biased.

    Incidentally, I'm a big fan of the monk danger's (Andrew Johnson's) book, "Elements of Programming with Perl" for anyone starting out in programming.



    -Spenser

    That's Spenser, with an "s" like the detective.

Re: Learning Perl as a First (programming) language
by frag (Hermit) on Aug 04, 2002 at 00:40 UTC
    Perl was not the first programming language I learned. (For values of "learned" broad enough to encompass an 8th grader learning to type '20 GOTO 10' on a TRS-80. Eventually that was followed by better training in Pascal, Scheme, and C, before Perl). But it was the first language I truly and warmly enjoyed using.

    It's worth reflecting on this: if a person ought to learn C first, so that they have experience with, e.g., memory management issues, what if the frustration of that experience drives them from programming? Or at least towards viewing programming joylessly, as a dreary, unpleasant chore? Is that a good thing, or a bad thing? Is it driving away a potential future contributor, or healthily thinning the herd? Should programming be a jealously guarded black art? Should newbies be blocked from invoking /usr/bin/perl unless they click through some Tk boxes that explain the importance of strict and warnings? (...actually, that last bit doesn't sound half bad.)

    I think how you answer this depends upon who you imagine being the subject of this thought experiement. Is it your 12 year old cousin, trying to create a simple game or print "Hello world"? Is it some one with no commercial asperations, looking to play around with their pc and web page? Is it Joe College, enrolling for his first comp sci class? Or is it somebody learning to code on the side of a main job (management, tech support), in order to volunteer to maintain his company's web interface?

    -- Frag.

    "Never could stand that dog."

Re: Learning Perl as a First (programming) language
by nmerriweather (Friar) on Aug 03, 2002 at 23:26 UTC

    Instead of focusing on which languages to learn, i would suggest looking at approaches to teaching.

    I've found Perl to be the hardest language to learn -- not because of the language, but because of books, classes, manuals that were simply unable to convey the principles behind programming

    I struggled on and off for a year, not knowing left from right, and just gave up. Then i came across two amazing books -- Flash f/x and Design (coriolos press) and Beginning PHP (wrox) -- both of which had authors that were unable to do what any Perl author had been able to do for me -- convey simple notions of loops, scalars, lists, hashes, etc

    After reading those books, i found O'reilley's 'learning perl' semi-decipherable, and the python documentation manageable

    The point i'm trying to make, is that the difficulty you'll encounter in learning your first language is going to be entirely on the ideology of programming -- not necessarily the language. So perl could be the best or worst first language -- depending entirely on the teacher.

Re: Learning Perl as a First (programming) language
by Phaysis (Pilgrim) on Aug 05, 2002 at 08:00 UTC
    BASIC, more specifically, TI99/4A BASIC, was my "first language". That was back in high school. Went on to college and started learning "real" languages (read: they actually do things). First was Pascal, as an intro to CompSci, then, the following year, COBOL. Pascal I'd recommend simply because it makes learning structured programming and a pantheon of algorithms like sorting and database manipulation quite easy for the uninitiated. (COBOL I wouldn't recommend to anybody!)

    From there I went on to a semester of C, and failed it with flying colors. I tripped-up on the most basic concept of the language: pointers. I couldn't understand them, couldn't understand the indirections, the referencing, couldn't keep it all straight in my head. None of the other languages we went over dealt with this concept. I gave up on the language and took an F.

    Fast forward a few years. I pick up Perl because a friend contracts me to design her website and incorporate a few features. Excited at the prospect of finally being able to write CGI, I dove in head first. Boy, was I ecstatic.

    Now, two and a half years later, I'm understanding, writing, and using advanced Perl techniques like OO, modules, references and regex. Recently I've been bitten by the bug to return to C and C++ so I can write natively-compiled apps which run fast and handle GUI's and whatnot (yes, I know there's Perl adaptations for these), and here's what I found to my surprise: after dealing with Perl, I finally understand C's deal with pointers! I'm able to draw parallels to my experience with Perl, and it all goes down like water.

    I really wonder if my experience would've been better had we been taught Perl in the intro to CompSci class instead of Pascal. Both are good languages; Pascal is good as a compiled language (a useful concept to teach the learning), but Perl has so much more potential for more advanced programming and more usefulness down the road.

    After changing my neural pathways for the better, it helped me to understand.

    -Shawn
    (Ph) Phaysis
    If idle hands are the tools of the devil, are idol tools the hands of god?

Re: Learning Perl as a First (programming) language
by Adam Kensai (Sexton) on Aug 05, 2002 at 15:48 UTC
    I learned Java way back in the day in my first cs 101 class. I'll admit I found it quite overwhelming. I wouldn't mind starting with perl and then having a 'step-up' in strictness later when I went to c/c++. I like the gentle sloping learning curve much better ^_^. In responce to above about wishing books geared towards learning programming through perl I've got something not quite so good. As an aside to one of my learning process projects at school I've developed an admittedly short tutorial on learning programming through perl. It should be up on my site in a couple of weeks. Happy Coding! ~Adam
Re: Learning Perl as a First (programming) language
by Scarborough (Hermit) on Jul 12, 2004 at 14:13 UTC
    I like meny others picked up PERL as a CGI language first at college, later as a web programmer and now as a way of handling very large database updates.
    Dispite PERLs power and speed of implementation I'm still glad I learnt formal languages first, in my case ADA followed by Java and a brief period of machine code. It taught me strict form and pretty layout which in business goes along way.
    The ease of building a simple web site adding a form and a CGI program does little to help you handle real life problems but I guess everyone has to start somewhere.