My technical and personal observations about softwares and other entities

Saturday, December 10

Perl Course (Day 2)

I have covered the following stuff-

  • How Perl treats integers, floating numbers, strings? Gave simple examples.
  • Played with simple values, how one can declare simple variables, how to assign them values, how to modify there values, how to access those values, how to print those values
  • Explaination on "my" syntax, scope of the variable.
  • Played with arithmetic operations (+, -, *, etc), String operation (.) concatenation. Also covered things like $int++, $str .= $str, explained the real life situation- while creating the log files how these things are used (e.g. $log="Log"; $log .=$date."txt"; this helps to create log file names like "Log20051208.txt").
  • Introduced loops (if-else, for, while). Explained on comparison operators like >, < , ==, eq, ne etc. Wrote small scripts for them to show how they are used.
  • Introduced $_ ? Gave example while using "while" loop?
  • How to pass the command line arguments to scripts? Yes, I have not introduced arrays yet, but told them to assume this thing. On the first day I have covered, how script can take input from user, so I have converted the script from taking inputs using command line arguments to take input from user in interactive mode.
  • Quiz 1. Write a script which takes two integers as input from user and prints the bigger number.
  • Quiz 2. Write the script which takes the input as two integers, prints the gcd .
  • How to do file operations? Yes I explained them today.
  • Quiz 3. Use ping command, use file operation, use while loop, use system() command, write script to check the availability of particular set of hosts on the network.

The second day was fun. I have used my mathematics background to give simple examples, explain the algorithms. I wanted them to be productive at the end of day, they were able to write script to check the availability of hosts :).

BTW- I have not explained them yet use strict;, use warnings;. I Wanted them to write something productive, then introduce all that things- so on third day I will introduce them.

No comments: