in reply to Copying Reports from Multiple Sites

I came to the same opinion as knexus, that the problem is around

<coded>$problem .= "$site_folder ";</code>

But tracing how I got there shows a couple other poor coding areas, improving which might improve debugging ability.

I began by searching the program for The following files were not copied over properly:. It turns out to be in _print_report(), followed by printing the keys and values of %$missed_reports. remeber for later, the error is associated with the values in the hash..

In the last two lines of code, $missed_reports is passed to _print_report(), obtained from _get_reports().

Near the bottom of _get_reports(), we find:

$problem .= "$site_folder "; $missed_reports{$_} = $problem;

So the question is, what are $site_folder and $_?

The inner loop sets $site_folder as the elements of $site_array, which is populated at the top of the outer loop. And $_ is set by the outer loop.

Pheeeww, huff, puff; that was a long trail ....

Using $_ as the default loop control variable is occassionally convenient because it avoids one variable.... and especially when there are some operators or functions which accept the default variable.

In this case, the default status is not used: $_ is used as an ordinary variable; that outer loop over which $_ appears is quite large---30 lines. So there is no advantage to using $_; instead, it serves as a counter-documentation, minimizing comprehensability of this variable.

Of course, code grows. You start off with something that was going to be short and to the point, and several specification changes later it has become a behemoth. That's why I generally avoid using default variables except in things like one-line map or grep constrructs, or in tiny programs. In any program ( as opposed to short script ), I consider whether anything is gained by anonymous brevity that is a significant improvement over a self-documenting variable name.

--
TTTATCGGTCGTTATATAGATGTTTGCA