Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Learning Perl

by venimfrogtongue (Novice)
on Mar 27, 2002 at 18:35 UTC ( #154753=perlmeditation: print w/replies, xml ) Need Help??

Hi everyone. This will be an easy question for everyone to answer as it has nothing to do with coding and such. I am really knew to perl and began reading Learning Perl 3 by O'Reilly which I found to be a good book. I cannot understand the last 3 chapters at all though. I am wondering how all of you learned perl. Did you read books? If so, which ones? Did you purchase traning videos? Play with code? ...



Replies are listed 'Best First'.
(jeffa) Re: Learning Perl
by jeffa (Bishop) on Mar 27, 2002 at 20:06 UTC
    My first introduction to Perl was back in 1996 when i started the road for my Computer Science degree. C++ was language of choice for the deptartment, we also had to learn enough assembly for the 8086 processor family to write a game in it, enough architecture to build simple computers with microchips, as well as understanding how an operating system works, how a compiler works, and any other electives we chose to take. So when a CGI course for Perl was offered in the Summer of 1998, i felt i was finally ready to learn some real Perl and jumped right in (note: learning the above items are not necessary to 'learn Perl', but are very important in understanding programming in general, which was-still is-my goal).

    In this course we used Perl to write a series of CGI applications. We had to 'roll our own', so to speak, but our professor understood the need for reusable software so we were introduced to and this kinda newer module, ;) Our final project was some sort of inventory control thingy that involved file locking and Berkley DBM's.

    But that was not my first introduction to Perl. That was back sometime around 1996. maverick was the guy at our college that 'coded Perl', that dark and mysterious language that nobody talked about in class. I knew right then and there that Perl was the language for me - it took me another 4 years before eduardo hired me to work at with Maverick. That's when i really started learning Perl.

    (By the way, one day in 1997 (after Eduardo and i took a Summer Java course)i was busy coding up a Java applet that would graph equations. I was stuck in a Java rut of having to take care of each and every condition. Ed pops along, "what are doing? in Java?!? check this out:" and in 10 minutes he wrote a Perl/Tk script that eval'ed the given equation. jeffa: "yeah, I need to learn this Perl thing...")

    Just a few days after i started work at Surfari, Ed introduced Maverick and myself to this site. I have been here for less than 2 years now and my Perl skills have more than quintupled.

    So, my advice to you is ... learn the basics. I learned the basics by enrolling in college and earning a degree. I understand that this is not option for everybody, your milleage will vary. Go back and read the Lllama book again, you will probably see that you missed a lot of things because programming is an iterative learning process: you do it over and over and over and over again until you get sick of it and find a better way: perl -le 'print join(" and ",("over")x100)'


    Lemon Curry?!?!

    UPDATE: Recommended reading:

    1. Code - read this book
    2. Perl Cookbook - don't code without it
    3. Data Munging - very useful and practical book
    4. CGI Programming - although it is a bit old
    5. Network Programming - mind altering
    6. Object Oriented Perl - can't fully grow without OO
    7. perldoc - it's all right at your finger tips and free
Re: Learning Perl
by Juerd (Abbot) on Mar 27, 2002 at 18:40 UTC

    Did you read books? If so, which ones? Did you purchase traning videos? Play with code? ...

    My first Perl experience was seeing it. I hated it, thought it would be even harder than C, and swore that I would stick to BASIC. I then saw a little book ("Programmeren in Perl" by Hildo Biersma), and read it. The misleading examples got me reading the official documentation, starting with perlsyn and perldata. I then skimmed over perlfunc and perlsub, and coded some lame CGI scripts for a few months.

    Then, I started reading more documentation. Still, only the official docs that are distributed with perl itself.

    It wasn't until recently that I began reading books, but most of the time, they just confirmed what I already thought.

    Reading perldocs is, imnsho, a very good way to learn Perl and its guts, but it does take some time.


Re: Learning Perl
by vek (Prior) on Mar 27, 2002 at 19:10 UTC
    I am wondering how all of you learned perl.

    I learned a lot from reading other people's code. Whenever there was something that I didn't understand I created my own little test programs and played with that piece of code until the light came on :-) (In fact, I still do that today especially with OO code) Allow perldoc to become your friend and use it - often. Programming Perl aka 'The Camel Book' can be an invaluable source of info - although it's really not geared towards *learning* Perl - more of a reference manual once you've got your feet wet. Try the Perl Cookbook - I found that one particularly helpful when learning Perl.
Re: Learning Perl
by lestrrat (Deacon) on Mar 27, 2002 at 19:11 UTC

    Ultimately I believe that you just need to gets your hands dirty and write code in order to learn any language...

    In my case, I used to have the Camel book and the "Cookbook" when I started, and all I did was just try applying the information that was there and learn via trial and error

Re: Learning Perl
by newrisedesigns (Curate) on Mar 27, 2002 at 19:23 UTC
    • Trying things out ("what can I actually do with perl on a webserver?")
    • Making mistakes ("Missing operator? Where?)
    • Using strict("You mean I have to declare every variable?!")
    • Keeping good notes and backups of every project I attempt, no matter the size.

    having some free time helps, too...

    John J Reiser
Re: Learning Perl
by cjf (Parson) on Mar 27, 2002 at 19:25 UTC

    If you're new to programming, I recommend you learn the basics of C first. It will help you understand Perl, and programming in general a lot better.

    After you've got the basics of C down, a read through the Lama is a great way to get started with Perl. Don't worry if there are a couple parts you don't entirely understand, you can come back to them later. The most important thing is to actually write some code. Writing short examples to teach yourself what the various functions do and to get used to the syntax will help a lot.

    After you've got an basic understanding of the syntax and a few of the core functions, start building fun stuff. Where the inspiration comes from ? has some great ideas for where to look for ideas. Check out CPAN as well for some very useful modules. Also make sure to read over the Essential CGI Security Practices thread if you're placing any of your scripts online. Best of luck to you :).

      It's interesting that you say this. Actually, learning Perl for me has helped me to understand C better. I started out with shell scripting...well, actually I started out with BASIC and Pascal first (as far as programming in an uninterpretted language) and when I got to Unix I was a heavy shell scripter. Eventually, I moved over to Perl but that transition was very slow because I was intimidated by Perl's flexibility. The fact that you could do the same thing 10 different ways syntactically correct and the functionality of your code would basicly do the same thing was just hard for me to adapt to idealogically. I just had to dive in. That was where the fun began. I have never turned back and now when I read my books on C I totally understand them now whereas before I just had a hard time understanding the wording.

      _ _ _ _ _ _ _ _ _ _
      - Jim
      Insert clever comment here...

        To tell you the truth, I'm always split on this issue. I feel that C is better for learning the basic programming concepts, and makes you appreciate Perl more once you get to it. The other side is that by learning Perl first, you get to build interesting things a lot faster and in doing so often keep the student more interested. So it does depend on the student somewhat, if they're really interested in programming in general I'd definately recommend learning C first. Otherwise it's a toss-up, and since I'm terribly biased towards Perl, I often recommend C just to maintain some shred of objectivity ;-).

        I definately agree with your point that learning Perl helps one understand C better, I know this was true for me. I also believe the reverse is true, C helps you understand Perl better (some experience in a *nix environment helps as well). Keep in mind, Whatever people think about C vs Perl as an introductory language, at least they're both not Java :)

      Like snafu, I have mixed feelings on this. My reasoning is a bit different, and I tend to agree with cjf. I realise C is sometimes a difficult language to get started with, syntactically, however it is also a very structured language.

      The flexibility of perl is nothing like I have seen before. Just the simple omission of rigid data-types makes it much easier to work with. (At least I think so)I also think that this same flexibility could become a problem if you START learning with perl.

      Plus, look how much more you appreciated that flexibility after working with such a rigid structure. :)
Re: Learning Perl
by cacharbe (Curate) on Mar 27, 2002 at 19:55 UTC
    My initiation in Perl went something like this:

    New boss - "Have you heard of Perl?"
    Me - "Um, yeah, it's a programming language with c-like structs, right?"
    New boss - "Close enough, this is the project I want you to create in Perl?"

    The rest of the conversation went on to involve me agreeing to write a diskcop utility that monitored space usage across several machines, had an interface for administration and a DBI backend to allow fine-tuning of allowed usage on a user level.

    So I guess you can say that I started by doing. I picked up the camel book and kept a window open to the man pages. I recommend this for anyone trying to learn a new language. Have a goal or application in mind that you can use to teach yourself. Take an old aplication and figure out how you would rewrite it in the new language. Not just a line by line conversion, but how would you take into consideration the strengths and weaknesses of the new language and change the implementation accordingly.

    I also really recommend reading the plethora of good code that is here, especially the tutorials. They can be invaluable.

    Finally, when all else fails, and you have coded and it doesn't work and you're stumped. Ask us. We reward well for effort, and you might even teach one or two of us something new by forcing us to research a better answer or method of doing it.


Re: Learning Perl
by snafu (Chaplain) on Mar 27, 2002 at 20:36 UTC
    You've posed a really good question. Here is how I did it. I tried reading Learning Perl first. I got through the first couple of chapters but I, admittedly, am an impatient reader when it comes to learning things.

    I am self-taught in *everything* I know about computers, programming, admin'ing, securing, etc. The fact is, that being self-taught is not a difficult thing to do if you are curious and know where to go to get the information you need. Literally, hundreds of thousands of people have put long hours into documenting how things work. So, the information is out there.

    I have a pretty big library of books. O'Reilly has been the recipient of my cash many-a-time. So, what I do is I get my reference material available. Then, I find a reason to code something. You know, I get a job or a task that I could code. Then, with all my gumption, I set out and start to code it with reference material in hand and irc connection to openprojects. Another thing I do is I hang out in places and watch what people say. You can learn a lot just reading peoples' comments. I like to try and help people out too. When you teach what you know, you learn more. I was able to get my boss to allow me to teach a beginning Perl class here at work every Thursday for 9 weeks. A lot of people are really getting a lot out of the class but *I* have been learning more about the theory of Perl from it which helps me to know more about how it works internally thus improving my coding skills.

    In the end, it is all subjective. Everybody has different ways of learning. One of my co-workers learns best by actually reading the whole book first and then trying to code something. I simply cannot do that. I don't learn from it.

    _ _ _ _ _ _ _ _ _ _
    - Jim
    Insert clever comment here...

Re: Learning Perl
by mr_mischief (Monsignor) on Mar 27, 2002 at 21:22 UTC
    My first introduction to Perl was from reading the Free Compilers and Interpreters List and the Language List. I am always looking for interesting languages. I saw some Perl on Usenet and decided to stick to Rexx for the time. This was when I was still in high school and computers were just a hobby and I was going to be a linguist or in the diplomatic corps because I loved natural languages.

    Fast forward to college, after I'd had trainging in multiple forms of Basic and two forms of Pascal, RPG/400, and COBOL in high school and actually went to my Ada class a bit in college, being by that time a computer science and philosophy dual major. I edited a few lines (about four) of Perl for a friend with lots of help from the docs. At this time, my favorite language was RedCode. My favorites for doing anything useful were x86 assembly and Rexx. I used a little QuickBasic and CA-Realizer when I was forced to work on Windows.

    Fast forward again to after I'd had mono, dropped out sick, gone back, and dropped out from a relapse, took lots of bedrest, then worked crappy non-computer jobs for a while to keep myself from being idle while I got my health back up. I was playing with computers mostly as a hobby again, and I was programming things for role-playing purposes, making my own command-line utils, patching various things in minor ways, writing text adventures for DOS and Linux, and messing with stuff for my friend's DOS dial-in BBS. I was using the Net but I wasn't writing anything for it yet nor was I working in the field yet. I was getting primed and ready.

    About a month after being hired as entry-level telephone tech support at a local ISP, my boss found out I knew something about programming. I hadn't touched anything but those four lines of Perl in all my life. I was given code that ran on one file, producing summary information, and told to modify it. It was written in Perl, and the modifications existed of a number of things. First was making the program run automatically on several files in several directories in a common directory subtree. Second was adding additional summary information to the report, which required new calculations be done. Third was to make the reports summarize the data across all of the files. Fourth was to make the program automatically rotate the logs and the summary data. Fifth was to make the program run faster than the original. Sixth was to add a debugging mode so we could check on the processing from time to time to make sur eI hadn't introduced any problem code. I was given the task on Friday afternoon, and I was handed the Llama and the Camel. I was to have everything done by the following Wednesday and fully tested and in production by the following Friday. I ended up with about 70% of the code being my own, and I got it done in slightly less than the time allotted thanks mostly to the Camel, the Llama, and the standard docs. Two years later, I wrote the same thing from scratch for another company in 1/3 the code from memory.

    When I really started learning the finer points of the language, it was because I was a regular on comp.lang.perl.misc and because I was graced with the responses and sometimes even personal email of people like merlyn, Abigail, nobull, and a host of others who so selflessly took the time to help. I think is was japhy who convinced me, when I was spending hours a day reading that group, to try this site. I liked it so much that this is where I spend most of my technical community time these days. I have kept learning things here, too. Hopefully along the way I've helped almost as many people as have helped me.
Re: Learning Perl
by TStanley (Canon) on Mar 27, 2002 at 19:02 UTC
    My first book was "Teach Yourself Perl 5 in 21 Days". As a starter book, it gave me the basics, and when I was ready for more, I got the Camel book.

    "Suppose you were an idiot... And suppose you were a
    member of Congress... But I repeat myself." -- Mark Twain

Hacking, reading and a class.
by Marza (Vicar) on Mar 27, 2002 at 21:50 UTC

    Perl was one of those things that fell on me. I used to work for an aerodefense and when huge layoffs went down. I went to one temp agency and they said all I was good for was a help desk job since I didn't know perl. Never mind the fact, I knew the scripts and was well verse in the Unix Kernal. I digress.

    I started by reading everything. I had the Oreily books, Learning is an Ok book but I think the Beginning Perl book by Simon Cozens is much better!

    I also have the Cookbook, Programming, Perl for sysadmins and Mastering Alogo books by Oreily.

    I took a class at the local JC and was lucky to have an excellent teacher who knew Perl inside and out. Many things fell into place after that.

    Getting on some sites helps a great deal. You can always find advice from here for example. I thought I would try and get info from a vendors website. Never did any programming for the web. I posted a help request and asked where to look for such info, mods, etc. Got 4 replies that helped me out!

    After you have some of the knowledge in your head, play play play. Try out stuff! That is the best way!

    Depending on how far you want to go I would also suggest Network Programming with Perl Stein - This is really high level if you are just planning to do simple scripts.

    If you are going to work with windows, I would also suggest Dave Roth's books Win32 Perl Programming and his modules..

    Good luck! It is a fun language and I am enjoying it still!
Re: Learning Perl
by rinceWind (Monsignor) on Mar 28, 2002 at 11:04 UTC
    I learned Perl almost by accident. Prior to my joining a software house in 1997, there were two factors.

    The software house had a product which was multi-platform written in C (about 2500 modules, 10,000,000 lines of code). It was a financial application that ran on VMS, 5 flavours of Unix and NT. The big issue with it was the lack of a common install and upgrade procedure across platforms. One guy was trying and failing to run a project to rectify this. The boss, a good chap and advocate of free software, bought two copies of the Camel book, one of which he plonked on the developer's desk. Still nothing happened though.

    When I joined, I learned of the fate of this project, and also inherited the webmaster role of an intranet site for development, on VMS with OSU HTTP_SERVER.

    I inherited a few very crufty CGI scripts and pages, mostly not written in Perl. But I had ideas for CGI front-ending the development process. Armed with the Camel book, I taught myself Perl, and started producing a site for development environment management and change control. I demoed this to management, and they were pleased - they acually encouraged me to work on this, as a major part of my job.

    In those days, I was by all accounts writing _bad_ code - I had not heard about use strict, nor had I discovered the vast range of useful modules available on CPAN.

    Whilst working at this place, I also bought Sriram Srivanam's book "Advanced Perl Programming", from which I learned about data structures, OO, and got an appreciation of what perl really is, and how it hangs together.

    I am in touch with my former colleagues in this company, and my scripts are still very much in use - sadly, no one has seriously taken up Perl since I left in 2000. They are doing web design, but mainly PHP and JSP.

    I really became a serious Perl programmer and advocate, when I discovered the Perl community. This was mainly via the London Perl Mongers, but also discovering Perl monks, and other discussion boards and lists.

    If anything has really honed my Perl programming ability, it's almost certainly the Perl monks site.

Re: Learning Perl
by strat (Canon) on Mar 28, 2002 at 13:09 UTC
    The first contact with perl was from a student of Mediatechnik and Design who lived together with me (about 1996). He had to write some cgi-Scripts, but as good as he was in design, as bad he was in programming (I prefered C at that time). So he often asked me for advice, and sometimes I happened to help him, although I found perl terrible at that time (didn't know about strict and -w). About 1998, I had to learn perl for a holiday job to change some codes. Well, it worked somehow, although I used to program perl in C-Style. Within two months, I tried my best to improve my perl-Skills by reading the books Learning Perl and Programming Perl and even Advanced Perl, which was much to early at that time.

    Later I got a project at a big german newspaper as a network administrator, but somehow I hardly managed any networks. I just wrote scripts to make management easier. There I got to know about Perl's beauty and rapid development, and started loving it.

    The scripts got bigger and bigger, by and by I got to know CGI, Tk, Database programming, OOP, Client-Server-programming. I bought and read every book about Perl I could get, and at this time, Advanced Perl Programming was too late because I nearly knew everything what was written inside, so it wasn't interesting any more :-)

    In 2000, I changed the project (where I still am) and develop a data synchronisation tool for a big german bank with data from several databases all over the world with a directory system, data exports, tools like parsing csv-Files and creating tcl-Configfiles for tools that set up directory schemes and the like.

    Besides, I'm writing small scripts for other customers, e.g. an automatic bill-writing system based on excel with an interface to accounting (=bookkeeping?) software, a chat (see which will propably never finish, and some minor stuff.

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Re: Learning Perl
by weini (Friar) on Mar 28, 2002 at 06:05 UTC
    I don't know when I first heard about perl - probably in some mag or during a LINUX setup. Reading some of the related newsgroups I got the chance to write a review for danger's "Elements of Programming with Perl". I did this as an absolute beginner to both Perl and Programming and learned very much by reading this book.

    The next steps were writing as much scripts as possible. Small tasks to be automated (lots of network stuff on Win NT-Machines).

    I think it's important to work on projects that you are really interested in - no matter how small they are and what they do. Have fun and learn the try-and-error-way. If you run into problems you have Perlpod and a friendly and helpful community on usenet ... and last but not least you have PERLMONKS :^)

    Of course this won't work for everyone but it does work for me - and I hope to get better slowly but surely.

    Enjoy! weini

Re: Learning Perl
by iamnothing (Friar) on Mar 28, 2002 at 19:10 UTC
    I bought Learning Perl and Programming Perl and read them from cover to cover and did all of the presented exercises. Then I purchased the Perl Black Book and the Perl Cookbook to see other options.

    I think that my strongest reading tool was the PerlDocs, though. Learning gave me the syntax and the rest gave me different options for solving different problems in Perl.

    The hands-down best way that you can learn to program Perl is to sit down and get your hands dirty with coding.

    If you are completely new to programming (I had come from a C/C++ world), then I would strongly recommend Python as a starting point. It will teach you the programming logic that you need, as well as Regular Expression support so that you won't be lost when you see them in it will teach you how to program for readability and support.

    Once you have that, pick up Perl, learn the syntax and develop your own style from what you have learned from Python and from the code that you will be reading in Perl. You'll discover that everyone has their own style, and you will have your own as well. You just need to learn to develop it as you learn rather than becoming entrenched in another's style.

    If you're not new to programming, then Learning Perl is a great starting point to get the syntax down. Next, check out the PerlDocs and as much code as you can stand to sort through. Take simple concepts and code them. Work your way up.

    I wouldn't recommend videos, though. They are rather useless when it comes to problem solving. Perl is too robust for a 6 series videoset.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://154753]
Approved by root
[LanX]: darn, I lost a post in preview

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2017-10-20 14:19 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (263 votes). Check out past polls.