Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Advice for Perl teaching

by Zenzizenzizenzic (Pilgrim)
on Jan 06, 2019 at 13:16 UTC ( [id://1228102]=perlquestion: print w/replies, xml ) Need Help??

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

I will be running some classes for my work on Perl. These will be for developers fresh from school who have never used Perl before. I would appreciate if I could get some suggestions as to items to be sure to address. Will obviously be covering the use strict ans warnings. First session(s) will be mainly dealing with reading Perl, as some my other team members will be there for learning how to port exisitng Perl scripts to Python, but eventually new development will be covered. Our normal Perl usage is for small scripts and interal web services. Thank you

Replies are listed 'Best First'.
Re: Advice for Perl teaching
by LanX (Saint) on Jan 06, 2019 at 13:50 UTC
    > items to be sure to address

    This might give you some ideas

    RFC: Self Assessment Perl

    I think the most challenging topic for new arrivals is "context".

    > learning how to port exisitng Perl scripts to Python, 

    new boom industry... :/

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Thank you! Will check the link out.
Re: Advice for Perl teaching
by talexb (Chancellor) on Jan 06, 2019 at 18:54 UTC

    It's a little difficult to guess what kind of things might be necessary to read Perl, but I think the most useful skill would be the ability to read variables and understand what kind of data structure is bring manipulated. Thus, I'd start with these three groups:

    • Scalars, Arrays and Hashes
    • Arrays of Arrays, Arrays of Hashes
    • Hashes of Hashes, Hashes of Arrays
    All this so that they can differentiate between $foo, $foo[0], and $foo{'zero'}, as well as $foo[0] and $foo->[0]. (The latter expression can be written as $$foo[0], but to me, that's much harder for the eye to pick up.)

    Picking the correct data structure is a pretty critical piece in solving a programming challenge. I used three parallel arrays in a recent solution, and the code worked incorrectly -- so I had to take a step back and re-think, and finally realized I needed a HoA. The final code was really quite elegant, and was a breeze to write.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

      Yes, I suspect the hardest part, at least for the scripts I'm familiar with will be the variable types. Thank you!
Re: Advice for Perl teaching -- ModernPerl
by Discipulus (Canon) on Jan 06, 2019 at 16:14 UTC
    Hello **8,

    > port exisitng Perl scripts to Python..

    Learn Perl to kill it ?!?! what a sad task ;)

    No really, your goal has to be much more difficult: let them love Perl while you teach it to them à la Diderot and Lavoisier

    Anyway, it depends a lot on the perl you must to port, but for the basic understandanding I strongly suggest to follow The ModernPerl Book as it explains Perl peculiarities and dark corners too, in a fresh, modern way.

    If they already know some rpogramming language it will be easy to understand. The incipit is exactly a gem for your needs:

    The Perl Philosophy Perldoc Expressivity Context Void, Scalar, and List Context Numeric, String, and Boolean Context Implicit Ideas The Default Scalar Variable The Default Array Variables

    I have a little scaffold in my bibliotheca about learning and teaching Perl.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Learn Perl to kill it ?!?! what a sad task ;) Not quite the case. :) My sub team will still be using Perl for new work, other sub teams only had old scripts. (The kind that give any language a bad name.) I will look into that book, thank you!
Re: Advice for Perl teaching
by davies (Prior) on Jan 06, 2019 at 20:31 UTC
      That link will be useful, thank you. And the XKCD comic WILL be include, I think. :)
Re: Advice for Perl teaching
by eyepopslikeamosquito (Archbishop) on Jan 06, 2019 at 21:54 UTC
      Thank you! Will check the links out!
Re: Advice for Perl teaching
by davido (Cardinal) on Jan 06, 2019 at 21:53 UTC

    Take them through Modern Perl. Or if that's too advanced, Learning Perl followed by Intermediate Perl.

    I think that starting out with a lesson on use strict and use warnings is putting the cart before the horse. How would someone understand what strict 'vars', strict 'refs', and strict 'subs' without first learning about package versus lexical variables, about barewords, and about references? Don't teach people to include code they don't understand. Start with the basics and build up from there. If you want to discuss strict 'refs', you need to discuss symbolic and hard references. If you want to discuss strict 'vars', you need to discuss package global variables and lexical variables. Treat your students like grown ups and they'll rise to the occasion.


    Dave

      Will look into those books. Thank you!
Re: Advice for Perl teaching
by RhetTbull (Curate) on Jan 07, 2019 at 04:46 UTC
      Most are familiar with Python, so I will check that out as well. Thank you!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-16 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found