Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Syntactic Confectionery Delight
 
PerlMonks  

Teaching Perl

by compgeek78 (Acolyte)
on Jul 11, 2005 at 05:25 UTC ( #473829=perlquestion: print w/ replies, xml ) Need Help??
compgeek78 has asked for the wisdom of the Perl Monks concerning the following question:

I am teaching a intro to programming class for some people who are fairly new to programming. I am doing an overview of lots of languages, some of which I am familiar with, some not. Perl is one I am not really familiar with yet, but one of the students would like to know some information.

I would like to cover the bare essentials of course (which I will learn myself). But I would also like to show some things which may be a bit more complicated, but are _really_ useful about Perl, things I might not learn in a short tutorial about Perl.

Any input would be greatly appreciated.

Comment on Teaching Perl
Re: Teaching Perl
by merlyn (Sage) on Jul 11, 2005 at 05:44 UTC

      A lot of people (well, relative to when a lot haven't) have been asking teaching from the Llama recently. I've had it in my mind to make a teacher's guide for the book although I haven't had time for that.

      However, I'm willing to talk to anyone who wants help figuring out how to structure their course. I'll do that for free, although Stonehenge has also trained the trainers at several places as well as modified our material for the internal use of some big companies. :)

      --
      brian d foy <brian@stonehenge.com>
Re: Teaching Perl
by virtualsue (Vicar) on Jul 11, 2005 at 05:46 UTC
    One of the great things about Perl is the fact that, by design, it is possible to do really useful things without getting bogged down in complexity. It's the most versatile programming language I've ever used in that respect. I use one-liners all the time, and I've written, when necessary, large scripts to perform fairly complicated tasks. Since you are new to the language, one suggestion is to learn about scalar and list context and when to use which. Another is to explore the delights of the hash data structure. It's useful to learn the basics of regular expression matching too. Have you looked at the Tutorials section of this site? It should give you many ideas.
Re: Teaching Perl
by gube (Parson) on Jul 11, 2005 at 05:49 UTC

    Go through Learning perl, Programming perl and Cookbook it's easy to teach perl and learn perl.

      Hi gube, perhaps it's better to link to saffari, there you can read the books on-line legally, you can even try it for free for two weeks.
      update
      ah gube, i see you updated your node. good.

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: Teaching Perl
by kprasanna_79 (Hermit) on Jul 11, 2005 at 05:49 UTC
    Hai compqeek78,
    Since u are going to start learning perl, i think u can start from geeks lessons.See this link from Randals Lesson.
    See perldoc.com for little more info..
    --Prasanna.K
Re: Teaching Perl
by cajun (Chaplain) on Jul 11, 2005 at 05:52 UTC
    I would strongly recommend Learning Perl (offsite) by our very own merlyn. I took a introductory class for Perl and this was used as the course material.

    Update: merlyn was (of course) faster than me.

Re: Teaching Perl
by nothingmuch (Priest) on Jul 11, 2005 at 06:47 UTC
    I think it's important to have someone who does know perl on board.

    The problem with Perl is that it gives a lot of power that requires discipline in order to make good out of it.

    Even if you have discipline, it's good to have someone with experience comment on and review your materials, and allow you to delegate questions from your students.

    -nuffin
    zz zZ Z Z #!perl
Re: Teaching Perl
by strat (Canon) on Jul 11, 2005 at 08:11 UTC

    I started teaching Perl with the Llama-Book some years ago, and found it quite good. I added a couple of scripts for the people to play with. The only thing I don't like so much is that there is one chapter with one topic, then the next chapter with the next, and people sometimes have just to learn stuff because it's in the chapter before they need to use it. So I enchanced the scriptscollection by and by, and over the years it became my own introduction into perl which I use in combination with the Llama- and Cookbook as further references. My way jumps a little bit around like a frog, but it's easy for the pupils to understand why to learn something.

    If you wan't to get it (only available in German), just goto my $homepage - talks and download the PDF in the line "Einführung in Perl". A lot of explanations is written there, but much more has still to be added.

    (I'm always looking for ways to improve it, so if you don't like something, I'll be gratefull if you tell me)

    Normally, the biggest problems are:

    • Why to use hashes
    • Why to use references
    • How to recognize of which type a variable is (array,hash, hashreferences ...)
    • List- vs. scalar context, and functions behaving differently (reverse, localtime, ...)
    • Sometimes regular expressions

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: Teaching Perl
by eyepopslikeamosquito (Canon) on Jul 11, 2005 at 08:12 UTC

    As for free resources, see:

    You should definitely cover scalars, lists, arrays and hashes, subs, and especially regular expressions. I feel the tight integration (and associated syntactic sugar) of regexs/hashes/lists into the core language are what give Perl its distinct and, for me, very sweet flavour.

Re: Teaching Perl
by SimonClinch (Chaplain) on Jul 11, 2005 at 08:25 UTC
    In addition to the basics, it seems worth explaining 'why use perl?', which can only be answered by mentioning features which are unique to perl, such as:

    - the many replacement functions for shell or DOS commands and C functions that avoid spawning to such scripts and programs.

    - the huge wealth of modules in CPAN

    - the relative flexibility of storage ("typeless" scalars, arrays and hashes)

    - adaptability of programming style and system level (OO, event-driven, data-driven, database interfaces, operating system call interfaces)

    Others might be able to suggest additions to this list.

    One world, one people

Re: Teaching Perl
by planetscape (Canon) on Jul 11, 2005 at 13:32 UTC

    I would definitely start with woolfy's Where and how to start learning Perl - it strikes me as an unparalleled collection of excellent links to get any learner/teacher started.

    Once you've covered that and have more specific questions in mind, try Tutorials and Super Search with keywords like "tutorial hash", for example.

    HTH,

    planetscape
Re: Teaching Perl
by adamk (Chaplain) on Jul 11, 2005 at 15:08 UTC
    Time and time again I find people that know the tiniest little bit of Perl, and find it kind of useful, but not really compelling.

    Until you introduce them to CPAN, usually via http://search.cpan.org/. And then their entire outlook changes.

    I've seen people come into work the next day after spending the evening browsing through it with a light in their eyes and talking about some private project they'd always wanted to do but it took too much work, but there's these modules that will make it really easy to do this, and that, and etc etc.

    Perl is the language for "getting stuff done" and CPAN is it's heart, and a good part of it's soul.

    Regardless of what you teach about the syntax of the language, from the point of view of comparing it with various other languages, no introduction would be complete without...

    "Perl is relatively unique amoungst the more common languages in that it has the CPAN, which is a repository of 16,000,000 lines of code by 3000 different Perl authors to do just about anything you could think of, and that are completely free for both personal and commercial use"

    If they are more businessey types, my Perl introduction is generally something like this.

    "Perl is the language for getting stuff done and getting it done fast. The first versions of Amazon were written in Perl. The first versions of Yahoo were written in Perl. The first versions of eBay were written in Perl."

    And that's about puts it in the right perspective for them. :)
Re: Teaching Perl
by samizdat (Vicar) on Jul 11, 2005 at 15:41 UTC
    I second SimonClinch's response, as well as merlyn's. Perl is a wonderfully apt system-level 'glue' language. I don't have any experience using it on Windows, but on a UNIX/BSD/Linux platform it really rocks.

    Speaking of which, you might consider opening up the question of programming environment as part of the 'what' and 'why'. When I was just learning bits and bytes -- literally, in 8086 machine language -- I read Kernighan & Pike's "The UNIX Programming Environment," and I said to myself, "WOW, that is neat! The OS is available to the program and vice versa," but all I had around me was bare hardware and DOS. It took me a lot of years before I was once again presented with UNIX in the form of a cheap commodity 486 PC box running FreeBSD 2.2.5 that juggled firewall, webserver, database and web site duties without a hiccup. Needless to say, many of the glue scripts as well as the web CGI were Perl. I fell in love with FreeBSD and Perl, and have looked with disfavor at anything M$ ever since, knowing now what computer power really is all about: direct access to the resources.

    I think the best way to intorduce programming is to get students' hands on a computer, or, at the least, have a local box set up with a projection monitor. The only language I think would be problematic to demonstrate on a vanilla FreeBSD box would be APL, which is obsolete anyway, but just about everything else is freely available in the Ports Collection. Java current is also a little strange due to Sun's reticience, so I'll give the nod to Linux for that one, but FreeBSD is so much more sane and stable than Linux in so many other ways that I find it well worth a little extra effort for Java.

    Start with shell scripts and system glue (like Perl), take a side trip through application and web programming (also possible with Perl), and end up with programming abstractions (yep, Perl again) and IDEs like Smalltalk. IMHO, many instructors do it backwards, starting with toy problems and ignoring the real world tasks like turning the lights on.

    When I was volunteering with 10-year-old kids, that was one of my prime themes: showing how programming concepts were the same whether controlling a disk drive or simulating a neural network. The importance of creating an understanding of the relatedness and layered-ness of all computing in a newbie can't be overstated, and it's easy to do when you can sit down at a console with root access.
Re: Teaching Perl
by barrachois (Pilgrim) on Jul 15, 2005 at 16:13 UTC
    I'm a one-man computer science department at a small liberal arts college, and teach perl regularly.

    In addition to the other sources mentioned, I've found Simon Cozen's online book Beginning Perl particularly helpful, including the short pieces on CGI, debugging, and the various helpful appendices.

    And while I appreciate the many good things about merlyn's Learning Perl text, I think the choice of leaving out how to invoke an object method fairly problematic, especially since most CPAN modules rely on this syntax. In my opinion, some discussion of object oriented methods are a necessary part of an intro programming course these days; they aren't just an "advanced" feature.

    - barrachois

      I think the choice of leaving out how to invoke an object method fairly problematic, especially since most CPAN modules rely on this syntax.
      Maybe you've not seen the third edition. We do indeed cover this, albeit lightly.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        Very lightly.

        I have a copy of the third edition (July 2001) in front of me now, and am checking ...

        The five page table of contents doesn't mention the word "object" that I can find, nor "CPAN" - though I see pack, unpack, grep, fork, and three chapters on regular expressions.

        The index does contain "object oriented programming" and takes me to two paragraphs on page 297 which point me towards perlobj and perlboot in the manpages.

        Appendix B, which perhaps you're refering to, does describe several CPAN modules. Within the paragraph describing File::Spec on pg 285 the Class->method() syntax is mentioned.

        Arthur Dent's phrase comes to mind : "It was in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying 'Beware of the Leopard'."

        Please don't get me wrong - the llama is part of what I used to learn perl back in the days of yore, and is still a strong resource. But I think this flaw is serious enough that I don't use it as a primary text.

        - barrachois

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://473829]
Approved by b10m
Front-paged by jbrugger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (18)
As of 2014-04-18 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (469 votes), past polls