Learning Perl, 3rd Edition by Randal L. Schwartz & Tom Phoenix Unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated May 21, 2004. UNCONFIRMED errors and comments from readers: (11) 5th paragraph; In the first line, the text "comp.lang.perl.*" appears. The "*" appears raised (and in italic), which makes it look like a footnote. Only now did I just realize that it was meant as a wildcard rather than a footnote. The "*" should be lowered or omitted. (11) 5th paragraph; The unconfirmed errata is wrong. The asterisk in "comp.lang.perl.*" is shown, as stated in the text, to denote a hierarchy of Usenet groups, e.g. comp.lang.perl.announce, comp.lang.perl.moderated, etc. The asterisk is not the smaller, superscripted, regular typefaced as other footnoted denotations. But rather, it is a full-sized and italicized as the rest of the Usenet group name "comp.lang.perl". There is no error. (21) Second to last paragraph; The word "three" in the first line is redundant. "....they're all three the same number" should read: "....ther're all the same number" (21) 2nd to last paragraph, 2nd sentence.; In the middle of the sentence: ... you write 0xFF or 255.[Line Wrap]000, so choose the ... The line break is misleading. The senetence appears to end, then the next sentence appears to begin with 000. (30) 16th line; Line reads: $barney = "fred ate a $meat"; Should read: $barney = "fred ate a $meal"; (30) 16th line; This unconfirmed errata item is wrong, the text is correct as it was trying to introduce what appears to be a misspelling to cause an undefined variable. (37) Second to last paragraph; "make an numeric" should be "make a numeric" [37] Code segment starting # Add up some odd numbers; $sum is not undef'ed before use. Seeing as this is an example of undef, there should be a reference to an undef. [38] The defined function: 1st code example; $madonna = ; if ( defined ($madonna) ) { print "The input was: <<$madonna>>\n"; # set off input with angles } else { print "No input available!\n"; } But in this example $madonna will always capture at least a newline. Hence, $madonna can never be undefined and will never get the "No input available" result. [38] The defined function: 1st code example;; This unconfirmed errata item is wrong. As the introductory text and footnote indicate, the line-input operator will return undef when end-of-file is detected (even possibly from the keyboard). This is what the example is trying to show. (43) First code line (in the comment section); "#easier to do that" should be "#easier to do than" (44) 4th paragraph, first sentence; second delimiter word was misspelled as delimeter {69} Code Sample; the sub which_element_is is written to return -1 for non-matches, which, if used when subscripting an array will return the last element of the array, probably not what the caller intended. So not only would returning undef be more "Perlish" it would be less dangerous. [77] 7th paragraph; The example given is $family_name{"betty"} .= $family_name{"barney"}; to explain how if the hash element does not exist, it is created. But I find the example a bit confusing if I assume that the element DOES exist. e.g. If $family_name{"betty"} contains 'Smith ', then am I right in thinking that the example given would make it become 'Smith rubble' - then if it was applied again it would become 'Smith rubblerubble'? If that's the case, then fine - I've understood what is happening, and just sanity testing the example too much. I feel the example is concentrating on what happens if the element does not exist, but if it does exist, I can't see what useful purpose the example serves. It would help me understand better if the accompanying text explained what happened if the hash element does exist and contains a value. {79} 3rd paragraph; The (excellent) book, on page 79, talks about what happens when you reverse a hash. Cool. Since I understand what a hash table "really" is, I understand that keys are unique, values are not guaranteed to be unique. You explain this concept well. However, you use the example of the IP address/ hostname hash as one that can be reversed because it only contains unique values. This is not true, if you think about it for a second. The example is: %ip_address = reverse %host_name; In fact, many hostnames may point to one IP address. Happens a lot, especially with the craze of virtual hosting. I don't know of an example that actually works for this concept, but this one does not. (103) second paragraph; 3rd Edition: Last sentence reads "If you pattern matches...", but should read "If your pattern matches...". (111) 3rd para; flintsone should read flintstone {138} 2nd block of code; In the program code an 'elsif' is used where an 'else' would suffice. (150) Last paragraph, last line; Sentence reads "Just as when the greater-then sign is used in shell" Change "greater-then" to "greater-than" (182) last paragraph; It's printed: But unless you can quickly can figure that ... where I supose would be printed But unless you can quickly figure that... {183} The book states: To remove empty directories, use the rmdir function in a manner similar to the unlink function: rmdir glob "fred/*"; # remove all empty directories below fred/ ... As with unlink, rmdir returns the number of directories removed, and if invoked with a single name, sets $! in a reasonable manner on a failure. According to the latest PERL to which I have access (5.6.0), this example does not work. "rmdir" can only remove one directory. Furthermore, the third edition of _Programming Perl_ states (on p. 777) the following: rmdir FILENAME This function deletes the directory specified by FILENAME if the directory is empty. If the function succeeds, it returns true; otherwise, it returns false. So I believe that both the sample code AND the description of what "rmdir" returns is erroneous on p. 183 of _Learning Perl_. (185) The line... you set it) with the utime function. That's because it's primary purpose is should have its primary purpose instead of it's primary purpose "it's" is a contraction standing for "it is." "its" is the possessive pronoun needed in this sentence. (192) Last paragraph, 2nd sentence; "This mean" should be "This means" (204) 2nd paragraph; "from 1 to 16, 1 to 32, or 1 to 63" should PROBABLY be "1 to 16, 1 to 32, or 1 to 64" (217) second to last paragraph. The formatting of the text '"}' at the end of $score{"barney"} is in the wrong font (it's in the font of the text rather than that of the code snippet.) (219) 1st code fragment; $family_name{$a} cmp $family_name{$a} or should probably be $family_name{$a} cmp $family_name{$b} or ^ {219} 1st code example; $personal_name{$a} cmp $family_name{$b} should probably read $personal_name{$a} cmp $personal_name{$b} ^^^^^^^^ because you've alread sorted by family name in the previous line (221) second paragraph; Every system thas has Perl ... should be: Every system that has Perl ... {225} third paragraph (and page 227, fourth paragraph, etc.) The text reads: ..., giving a format string of "a40 C I5 L". Each record is thus 55 bytes long. ... On my system, and I assume most systems that readers of the book have access to, this format comes out to 65 bytes long as 'I' is a four byte integer, not a two byte integer as described in the text. I understand that Perl sometimes relies on underlying 'C' types and that 'C' ints can be two bytes on some systems. (Unfortunately, I can't find any Perl documentation that states how these pack formats relate to the underlying architecture.) But this should either be made clear in the text or an example that is likely to work on the majority of reader's machines should be used. (e.g. use 'S' format since we're trying to contain values up to 300.) (246) first footnote; The second sentence states "If it sounds as if we're not repeating..." should probably state "If it sounds as if we're repeating...". (249) 1st paragraph; exercises was misspelled as excerses (255) End of 7th paragraph; At the end of the 2nd last paragraph on page 255 there's an asterix to indicate a footnote ("since Perl has to look up $word in the hash just once.*"). The footnote for this does not appear until the next page (p256). {263} Last paragraph; This pattern is surprisingly tricky to get right. The pattern shown, /(\w+)(\s+\1)+/, matches |I thoughhat that that was the problem|. It is supposed to match |I thought was the problem|. The pattern requires a leading word anchor, thusly: /\b(\w+)(\s+\1)+/. {264} last line; The second exercice asks for an identifier name (made of letters, digits, and u nderscores...), so we can suppose that the name as at least 2 characters. The proposed answer for those names is [a-z_]\w*, but that match names with on ly one character. I understand that a better solution would be [a-z_]\w+ Index: missing "$$" entry, it's covered on 183. (284) Last paragraph; "It's primary uses are" should be "Its primary uses are" [313] Index; heading "S" Missing Entry for "Scooby Doo, Pronouncing 'Windex'" should point to p 209