Perl Cookbook by Tom Christiansen & Nathan Torkington Here are the changes made in the 1/00 reprint: {55} In the first code example, changed } while ( $w >= 1 ); to: while ($w >= 1 || $w == 0) {81} In problem 3.7, added a closing parenthesis to the third line of the first solution. {161} Perl example at the top now reads: $ echo longest | perl -ne 'print "$&\n" if /(long|longer|longest)+/' long And in the Awk example later: $ echo longest | awk 'match($0, /(long|longer|longest)+/)\ { print substr($0, RSTART, RLENGTH) } ' longest (192) `Even effectively' is now `Even effectively' (2 spaces) {200} Removed trailing slash from (?=^.*?bell)(?=^.*?lab)/ in the 3rd paragraph. {218} Keyword = Value Changed: m/(\w+)\s*=\s*(.*)\s*$/ # keyword is $1, value is $2 to: m/(\w+)\s*=\s*(.*?)\s*$/ # keyword is $1, value is $2 {218-219} "IP Addresses" section now reads: Dotted quads (most IP addresses) # XXX: fails on legal IPs 127.1 and 2130706433 m{ ^ ( \d | [01]?\d\d | 2[0-4]\d | 25[0-5] ) \. ( \d | [01]?\d\d | 2[0-4]\d | 25[0-5] ) \. ( \d | [01]?\d\d | 2[0-4]\d | 25[0-5] ) \. ( \d | [01]?\d\d | 2[0-4]\d | 25[0-5] ) $ }x {242} Switched places of 2 blocks of code. {284} Changed: $data = '/usr/share/games/fortune'; to: @ARGV = ('/usr/share/games/fortune') unless @ARGV; {295} In code at bottom: Changed /usr/adm to var/log. {296} In code at bottom: changed: ($file, @addrs) = @ARGV or die "usage: $0 addr ..."; to: ($file, @addrs) = @ARGV or die "usage: $0 file addr ..."; {305} In code at bottom: Changed usage tee... to usage $0... Fixed indent of 3rd } {307} First line of code: Changed /usr/adm to var/log {317} Code under Discussion: Changed: move("datafile.new","datafile.dat") to: move("datafile.dat","datafile.new") (352) Line 14: Changed "hander" to "handler." (356) Paragraph above "See Also": Changed: "before Perl support proper references." to: "before Perl supported...." Fixed alignments of functions under "Solution" (367) Line 7: Deleted "an" from: "through an undefined references" {368} Figure 11-3:, the last two line of text now reads: Changed: print "$$a $b\n"; 3 3 to: print "$$a\n"; 3 (369) Line -16: Deleted "create" from: " thus creating create groups of people." {398} Last line: Changed: Poker::Deck::shuffle(23) to: Cards::Poke::shuffle(23) (459) 2nd paragraph: Changed: "speed and space arrays..." to: "speed and space of arrays..." Changed: struct Card => map { $_ => '$' } qw(name color cost type release text); to: struct Card => { map { $_ => '$' } qw(name color cost type release text) }; (added curly brackets) {462} Near bottom: Changed "$obj2" to "$obj_target" {477} Output of show_strnum: Changed: values are Red, Black, RedBlack, and 0 to: values are Red, Black, RedBlack, and RedBlackRedBlackRedBlack {478} In the concat function, Changed: return StrNum $inverted ? ($s2 . $s1) : ($s1 . $s2); to: return StrNum($inverted ? ($s2 . $s1) : ($s1 . $s2)); In the repeat function, Changed: return StrNum $inverted ? ($s2 x $s1) : ($s1 x $s2); to: return StrNum($inverted ? ($s2 x $s1) : ($s1 x $s2)); {492} Code: Changed: untie %hash; # close the database to: untie %HASH; # close the database {494} Code: Changed: untie %hash; to: untie %HASH; (495) Top of page: Changed "Reads" and "writes" to "Read" and "write" (504) Solution section: Changed: "Use the CPAN module MLDBM to values more complex values" to: "Use the CPAN module MLDBM to store more complex values" {516} Line above Discussion section: Changed: # --output=string or --output=string to: # --output=string or --output string {605} Changed: INADDR_ANY is a special address, meaning ``listen on any interface''. If you want to restrict it to a particular IP address, add a C parameter to your call to Cnew>. If coding by hand code, do this: to: If you have several network interfaces, the kernel decides which one to use based on your current routes. If you wish to override this default, add a C parameter to your call to Cnew>. If coding by hand code, do this: {652} Changed: $mailer->open( 'From' => 'Nathan Torkington ', 'To' => 'Tom Chritiansen ', 'Subject' => 'The Perl Cookbook' ); to: $mailer->open( { From => 'Nathan Torkington ', To => 'Tom Chritiansen ', Subject => 'The Perl Cookbook' } ); (Note addition of {} around the parameter. Omission of the ') {684} Code: Changed: die "cannot fork: $!" unless defined ($pid = open(SAFE_KID, "|-")); to: die "cannot fork: $!" unless defined ($pid = open(SAFE_KID, "-|")); {685} Deleted $pid = open(KID_TO_WRITE, "|-"); which was above line: die "cannot fork: $!" unless defined($pid = open(KID_TO_WRITE, "-|")); {731} Changed `index.html' to `scooby.html'