Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Advice for Perl teaching

by talexb (Canon)
on Jan 06, 2019 at 18:54 UTC ( #1228112=note: print w/replies, xml ) Need Help??


in reply to Advice for Perl teaching

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.

Replies are listed 'Best First'.
Re^2: Advice for Perl teaching
by Zenzizenzizenzic (Beadle) on Jan 07, 2019 at 22:50 UTC
    Yes, I suspect the hardest part, at least for the scripts I'm familiar with will be the variable types. Thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1228112]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2019-07-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?