Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-18 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found