Error in textbook
Oct 17,2007 06:16
Patrick Finnigan reported the
following error in a comment in the book:
=====
I wanted to report an error in the textbook on page 383 that I ran into with the
past HW. A line near the bottom of the page says:
"$number = int(rand 4); # Computes a random integer 0-4"
This is false, because the rand function in Perl is exclusive. "int(rand 4)"
computes a number between 0 and 3. rand function perldoc:
http://perldoc.perl.org/functions/rand.htm
=====
This is a good example of the usefulness of the online perl documentation at:
http://perldoc.perl.org/
Check it out!
g/m
=====
I wanted to report an error in the textbook on page 383 that I ran into with the
past HW. A line near the bottom of the page says:
"$number = int(rand 4); # Computes a random integer 0-4"
This is false, because the rand function in Perl is exclusive. "int(rand 4)"
computes a number between 0 and 3. rand function perldoc:
http://perldoc.perl.org/functions/rand.htm
=====
This is a good example of the usefulness of the online perl documentation at:
http://perldoc.perl.org/
Check it out!
g/m