Perl for Web Site Management by John Callender The 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 December 3, 2003. UNCONFIRMED errors and comments from readers: (115) Middle of page; Here's the quote from 'Perl for Web Site Management': "if you put a 'my' declaration on the variable that will hold the current element for each trip through a 'foreach' loop, the variable's scope extends only from the declaration to the end of the loop." Well, this is pretty much the default action of the variable in the foreach loop. As the Camel book points out, p. 119, "The loop variable is valid only from within the dynamic or lexical scope of the loop.... In either case, any previous value the localized variable had before the loop will be restored automatically upon loop exit." The real reason for the 'my' declaration in the foreach loop in 'Perl for Web Site Management' is that Perl would otherwise complain about an error at this point due to the 'use strict' pragma that is in effect. If 'use strict' had not been previously called the 'my' declaration would not have been needed to keep the scope to the end of the block in this example. {119} 1st paragraph; $exhibit{$co_name} should be changed to $listing{$co_name} {194} - this is about the way rounding error can (and will) accumulate due to the division in the line $total_mb += ( $bytes / ( 1024 * 1024 ) ); which is inside a loop going over all the lines in a web log. The rounding inaccuracies here can be quite large (percentage-wise) ( especially for a website with lots of relatively small files ). A more accurate ( and also less computationally expensive ) approach is : for ( each line ) { . . $total_bytes += $bytes ; . . } $total_mb = $total_bytes / ( 1024 *1024 ) ; ( It's possible that we might want to use $total_bytes as a BigInt to avoid overflow problems, but that's another story. )