Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

How to teach perl to novice programer

by chrestomanci (Priest)
on Aug 26, 2013 at 08:04 UTC ( #1050917=perlquestion: print w/replies, xml ) Need Help??
chrestomanci has asked for the wisdom of the Perl Monks concerning the following question:

Greetings wise brothers. I have a question concerning our evangelical mission to spread the good news of perl to our initiates who wish to learn it's great power.

I have been approached at work by a colleague from the marketing department. She has asked me to teach her programming in perl during break times. My boss is happy for me to do this provided I don't do so in work time. The colleague has a scientific education, but no prior experience I computer programming.

The problem is that I have no idea how to teach programming to a novice, and I don't know what text book to use. There is a copy of the Camel Book available, as well as some more advanced perl programming books, but nothing for beginners.

Can you recommend a suitable text book for a beginner? Hopefully something with some exercises in, so that I don't have to think up lots of simple programming problems.

Is the current Strawberry perl distro sufficient as a programming environment? Is Padre included these days?

More fundamentally, do you think that perl is a suitable language for a beginner? Or would it be better to find a teaching language such as scratch for the fundamentals (variables, loops, functions etc), before moving on to perl?

Replies are listed 'Best First'.
Re: How to teach perl to novice programer
by kcott (Canon) on Aug 26, 2013 at 09:42 UTC

    G'day chrestomanci,

    I went to the O'Reilly Perl page to find you a link to Learning Perl and immediately found two others of interest. If you hunt around, there may be others.

    Follow the links for more information, reviews, prices, formats, etc. The first two have exercises and separate answers to the exercises.

    You might also consider using the online documentation; although, while that has many examples, it doesn't have exercises.

    • perlintro -- a brief introduction and overview of Perl: This introduces concepts in an order appropriate for someone learning to program; starting with sequence/selection/iteration and then moving into I/O, subroutines and more advanced topics.
    • perl - The Perl 5 language interpreter: This is the main perl manpage. It has a Tutorials section; there's tutorials in other sections but they're mostly of a more advanced nature (at least for someone with little or no programming experience). The Reference section would probably provide a useful adjunct to whatever books you choose.

    I haven't used Strawberry Perl for a couple of years but I'd be surprised if it wasn't "sufficient"; it certainly would've been when I last used it (maybe v5.10.x).

    -- Ken

Re: How to teach perl to novice programer
by CountZero (Bishop) on Aug 26, 2013 at 09:19 UTC
    That seems to be a fun project!

    Perl is a very good programming language for starters. The nice thing is that you can start with simple things and that once your students advance in knowledge you can introduce more advanced concepts, yet even with the simple elements they have learned in the beginning they can already write working and useful programs.

    A simple "beginners level" book is "Perl for Beginners", freely available at BookBoon.

    If you are on Windows, Strawberry Perl is indeed a good choice. Padre isn't installed by default, but as it is just another module, you can install it yourself from CPAN.


    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

    My blog: Imperial Deltronics
Re: How to teach perl to novice programer
by zork42 (Monk) on Aug 26, 2013 at 09:43 UTC
Re: How to teach perl to novice programer
by Anonymous Monk on Aug 26, 2013 at 10:50 UTC

    Maybe start by teaching programming using or or some such ( Logo Turtle ), before moving onto perl?

    Below is some food for thought, a recurring theme is know-your-audience, be-a-hero(solve something they frequently encounter as they watch), teach/work towards solving a real problem that interests them

    You gotta start by introducing variables(buckets), how to put stuff in them (interpolation), when they live/die (scope), ... basically do a few walk throughs of how a program runs (now the bucket is empty...)

    Then move onto introducing file+folder model, how files work (files are iterators), but don't delve into readdir. Teach File::Find::Rule for obtaining a list of paths. Maybe Path::Class/Path::Tiny for working with paths. no readdir, its too low-level.

    Then give overview of the process model (STDIN/STDOUT/STDERR/@ARGV) and the shell

    Then have the beginner start solving that real problem they're interested in

    Ask what is the goal of program? Ask what next change should do? What series of steps should play part? What input/output/result/effect? How to go organise it? ... design the program on paper before start writing it, backing up incremental improvements as you guide over beginners shoulder -- after the initial planning session (which beginner adds as comments ) you be quiet until they're done, then you review together -- ask beginner to describe step/by/step how the program works, then run the program and see what happens, then praise the things that correct, explain any misunderstandings , and make backup and have the beginner fix the program while you wait

    By the time you're done with buckets you'd have 10-30 small programs, at least half typed by the beginner Each new metaphor/model/topic should start with your writing a file as beginner watches, then beginner writing a file, fixing typos, dumpering , fixing thinkos, repeat, you-review-together, you-fix-for-beginner (add comments to file explaining any typos/thinkos and how to overcome them), beginner-type-fixes .... and you end up with 10-50 small files the beginner can review

    Naturally this type of 1-on-1/master/guru-style learning requires explicit agreement/willingness from both parties -- its very effective , esp if both teacher/learner are nice and positive and eager... The important dynamic to develop is STOP - Stop, Think, Observe, Plan then Act then repeat STOP ; In no time at all you'll both be thinking like computers, you'll know where to look (what to dumper), what to expect, what to call it ... how to know what you mean, ask questions the smart way

    Also, while you're discussing how to solve each task/goal/step walk the beginner through RTFM-ing a couple of times, from checking the faqs( perlfaq4#How can I get the unique keys from two hashes? ) to searching the docs, to searching the perlmonks :)

Re: How to teach perl to novice programer
by dasgar (Curate) on Aug 26, 2013 at 14:31 UTC
    Is the current Strawberry perl distro sufficient as a programming environment? Is Padre included these days?

    Strawberry Perl does not come with Padre or the needed Wx modules for Padre, but those can be installed from CPAN. An alternative would be DWIM Perl for Windows, which is Strawberry Perl 32-bit and does include Padre and a number of other modules too.

Re: How to teach perl to novice programer
by McA (Priest) on Aug 26, 2013 at 12:37 UTC
Re: How to teach perl to novice programer
by Jim (Curate) on Aug 26, 2013 at 18:16 UTC

    You might recommend to her that she enroll in the Coursera course titled Learn to Program: The Fundamentals (University of Toronto). This online course is seven weeks long and doesn't presume any prior programming experience. The only requirement is a good grasp of grade school math. The course started last week, but if she enrolls right away, I'm sure she can catch up quickly.

Re: How to teach perl to novice programer
by nimdokk (Vicar) on Aug 26, 2013 at 16:02 UTC
    I'm in about the same situation of training a new staff member and I am having him teach himself Perl with the "Llama Book" (and maybe an off-site training class). We don't do a lot of hardcore programming with Perl, mainly utility scripts and such, very basic stuff for the most part.
Re: How to teach perl to novice programer
by vincent_veyron (Sexton) on Aug 27, 2013 at 10:42 UTC

    Have your colleague read the tutorials/books suggested above, at least the first 100/150 pages to get a grasp of the basic notions.

    Then have her subscribe to comp.lang.perl.misc or this site and read the messages and their replies, progressively trying to find an answer to the questions asked.

    This is how I learned; I applied this technique for a 5 day course with a C programmer with twice my experience; it's very interesting for the student and you have no work to do.

Re: How to teach perl to novice programer
by Anonymous Monk on Aug 27, 2013 at 20:02 UTC
    Ask her about the type of file-related things that she does as part of her job, where summarization / searching / extracting specific data would be helpful. She must have tons of spreadsheets in Marketing: write some out as length-delimited text files and create projects around their manipulation. That way she can see real applications of Perl to her job at the start (or at least once she can say hello to the world).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1050917]
Front-paged by Corion
[huck]: a first for me, got someone at credit card services to give me their credit card number!!

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-03-24 19:27 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (306 votes). Check out past polls.