in reply to Copying Reports from Multiple Sites
$problem .= "$site_folder ";
would have to be involved. Expanding the search out from that point I see that the array @site_array is being looped over and that $problem is being reset just before it. Hmmm, that seems Ok.
Branching out to the next loop I see that @site_array is initialized before the outer loop (which walks thru the reports) and not always within the loop.
I think that is the problem. The @site_array array is initialized differently depending on $site_locations. In the 'All' case new sites are pushed onto the array leading to an accumulation of the sites and the problem you are seeing. So, I think you need to clear the array in that case.
if ($site_locations eq 'All') { @site_array = (); #clear the array for my $site (sort keys %$sites) { push @site_array, $site; } ...
I have not tested this, it's just my first guess. I hope it helps.
FWIW: My litte Rant; I used to produce "Write-Only" code until I had to debug some crap I "Wrote" in the past and did not have the faintest clue what I had done or why. I comment code now! :-))
|
|---|