[Israel.pm] Perl Hebrew Tutorial - Second Edition
offer.kaye at gmail.com
Thu Jul 22 15:19:17 PDT 2004
On Wed, 21 Jul 2004 21:32:13 +0200, semuel wrote:
> Hello There.
> PerlHebTut2 is continued to be written.
Here are some comments:
1. In chapter 1.4, change:
2. In page 6 (the end of chapter 1.6), change:
C:\perl\bin\perl -w first.pl
This will make it more compatible with the Unix version (which has the
"-w" inside the file).
In addition, after (or during) the explanations of the example, I
would add a few simple explanations regarding the basics of perl
1. Every (simple) statement must end with a semicolon (";"), except
for the last statement in a control-flow block.
2. Comments start with "#" and finish at the end of the line. There
are no "multi-line comments" (well, there are embedded POD directives,
but never mind).
3. Perl is whitecase insensitive (except for a few places like inside a string).
4. Built in functions can be used with or without parentheses ("()") -
both forms work.
If you want to make a whole chapter of this, read "perldoc perlsyn" ;-)
3. In chapter 2.1 you say that there are 4 variable types. This is
*wrong*! There are only three: $scalars, @arrays and %hashes. There
are also &subroutines, FILEHANDLES, LABELS, FORMATS and Packages, and
finally the catch-all *glob. These are all (except for glob) "types"
that appear in Perl's "Symbol Table". Glob is special, it basically
means "any and/or all" types. Now if you want to confuse the newbies
reading your tutorial, go ahead and write all that :-)
If you want to make life simpler, just say that there are 3 variables
+ some other "types" like &subs and FILEHANDLES (the two most common
types that Perl newbies use) that have their own namespaces, separate
from the 3 variable types.
4. Nowhere in the introduction do you say that $x != @x != %x (but
it's usually confusing and a bad idea to use the same name for
different variables). Still, they need to know this...
5. In chapter 2.4, at the bottom of page 8, you say "write $m;" in
your code. While there really is a function called "write" in Perl
("Writes a formatted record (possibly multi-line) to the specified
FILEHANDLE..."), I'm assuming you didn't mean it on purpose, and
anyway if you did it would be confusing to newbies- just change to
"print $m;", is my suggestion.
6. In the middle of page 9 you write:
כאמור, הדוגמאות הנ"ל עובדות
I don't, however, see the connection. All you are doing is adding a
scalar to the array or taking it away. What does that have to do with
arrays being flattened when placed inside another array?
7. In the middle of page 10, change:
האיבר האחרון המערך
האיבר האחרון במערך
8. In the same page, the splice explanations, should be "removes
elements 3,4 from @arr1", not elements 2,3.
9. When explaining about referencing the last element using
$arr[$#arr], you should than also mention negative indexes - $arr[-1]
is the last element, $a[-2] is the element before last, etc...
10. Too tired to continue for now. Will send you more comments tomorrow :-)
More information about the Perl