Given that these are C++ programmers, there are a lot of things you don't have to spend much time on. You can show them one while loop and they'll instantly know how to write while loops. You can show them one if/elsif/else series and they'll understand how that works immediately too. Even suffix conditionals like dosomething unless condition will probably not be hard for them to pick up. (They may not immediately start writing that way, but they'll be able to read code that does that and follow it okay.)

You'll want to reserve a little more time for things that are starkly different in Perl from C++. You want to spend at least an hour on context, for example. You want to show them Perl builtins that do different things in scalar versus list context, and show them different ways to create different kinds of context (scalar versus list assignment, operators that expect a scalar (such as + and .), list operators (such as print), and so on). After you think they understand all of that, you also want to show them how to make their own subroutines behave differently according to context. If you have time, you'll also want to explain the advantages of this, which won't be immediately apparent to some of them probably.

If you have time, it would be nice to spend an hour or so on pattern matching.

You also dursn't fail to explain that Perl doesn't have statements, only expressions, and that *ALL* functions in Perl, if followed by a left parenthesis, take their argument list inside the parentheses and fit into the larger expression. You specifically want to say that the print operator is not an exception to this. Show them how turning on warnings will give them "useless use of foo in void context" messages when they forget about this.

Also, if you have time, talk about the difference between and and or versus && and ||. The former are useful for linking whole expressions together, but the latter are more useful for linking simple conditions together within a larger expression. When in doubt, parenthesize everything.

Bonus points if you have time to show them CPAN and several useful modules. Some examples of modules you might show them include WWW::Mechanize, HTML::Tree, Data::Dumper, Archive::Zip, Net::Server, and DateTime, but ideally you should pick modules that would be immediately useful for whatever it is that they do daily.


;$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$;[-1]->();print

In reply to Things you cannot leave out of a one-day Perl course for C++ programmers by jonadab
in thread Requesting suggestions for one day Perl course by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.