Perl Cookbook by Tom Christiansen and Nathan Torkington Here are the changes that were made in the 12/98 reprint: 505.1.-1 Tom Toming: ARRAY(0x73048) (ARRAY(0x73e4c) Should be: Two Toming: ARRAY(0x73048) (ARRAY(0x73e4c) 508.3.2 use DBI; $dbh = DBI->connect('DBI:driver', 'username', 'auth', { PrintError => 1, RaiseError => 1 } ... Replace that code with use DBI; $dbh = DBI->connect('DBI:driver:database', 'username', 'auth', { RaiseError => 1, AutoCommit => 1 }); $dbh->do($SQL); $sth = $dbh->prepare($SQL); $sth->execute(); while (@row = $sth->fetchrow_array) { # ... } $sth->finish(); $dbh->disconnect(); 508.-1.1 The fourth argument is an optional hash ref defining attributes for the connection. replace "ref" with "reference" replace "for" with "of". 508.-1.-1 ... except that die is used instead of warn. add AutoCommit says that you don't want to deal with transactions (smaller DMBSs don't support them, and if you're using a larger DBMS then you can read about transactions in the DBMS documentation). 509.2.1 Be sure to disconnect from the database ... disconnect(DBI::db=HASH ...) replace the paragraph and the courier text with: Statement handles and database handles often correspond to underlying connections to the database, so some care must be taken with them. A connection is automatically cleaned up when its handle goes out of scope. If a database handle goes out of scope while there are active statement handles for that database, though, you will get a warning like this: disconnect(DBI::db=HASH(0x9df84)) invalidates 1 active cursor(s) at -e line 1. The C method ensures the statement handle is inactive (some old drivers need this). The C method, er, disconnects from the database. 509.-1.7 { RaiseError => 1}) or die "connecting : $DBI::errstr\n"; should be { RaiseError => 1, AutoCommit => 1 }); 510.1.3 while ((@row) = $sth->fetchrow) { should be: while ((@row) = $sth->fetchrow_array) { <510.2.2> www.hermetica.com/technologia/perl/DBI/index.html should be www.arcana.co.uk/technologia/perl/DBI/ 326.-2 # change $file should be # change $newname Page 531, Example 15-4 vbsh: The last line of the code reads $term->addhistory($seed_line); But it should read $term->addhistory($cmd); 657.2 $pop->login($username, $password) should be defined($pop->login($username, $password)) 658 all occurences of $pop->login(...) should be defined($pop->login(...)) 419.-1 expect to find them in Sample/auto/foo.al and Sample/auto/foo.al should be expect to find them in Sample/auto/foo.al and Sample/auto/bar.al 86 line 3 $time = gettimeofday - $t1; should be $time = gettimeofday - $begin; 165.5 ($a = $b) =~ s/x/y/g; # copy $a and then change $b should be ($a = $b) =~ s/x/y/g; # copy $b and then change $a 31.-2.-2 return quoteword(",", 0, $_[0]; should be return quoteword(",", 0, $_[0]); 453.-1 ; bless($self, $class); return $self; should be }; bless($self, $class); return $self; 449.5.4 bless($obref, $classname); # Mark it of the right type should be bless($self, $classname); # Mark it of the right type 449.5.7 return $obref; # And give it back should be return $self; # And give it back 486.-3.1 [No way! Way!!] = EVIL> should read [No way! Way!!] => EVIL p. 174 it would be much faster to use s/<[^>]*>//g should be it would be much faster to use s/<[^>]*>//gs p. 237 There's no extra less than symbol should be There's no extra greater-than symbol p.253 $rv = sysread(HANDLE, $buffer, $BUFSIZ); or die "sysread: $!"; delete the "or die ..." line Also, in the last page of the acknowledgements, Richard Allen should be Richard Allan.