Mark,
You were spot on when you said "there must be some side-effect obscuring the code"
$upcoming_digest is set on line 281:
Here's the code snippit
281 my $digest = $upcoming_digest->{$upcoming->{'borrowernumber'}} ||= {};
This is saying
If $upcoming_digest->{$upcoming->{'borrowernumber'}} is false, set it to an empy hashref.
Then set the $digest to the value of $upcoming_digest->{$upcoming->{'borrowernumber'}}.
It just so happens that
advance_notices.pl was the first piece of Koha code that I read through in detail ,and I remember griping about it in #koha:
Your reply was
15:39 mtompset > Oh my! That is perl abuse. :P
;-) ;-)
Unfortunately, I didn't file a bug report as suggested by tcohen.
--Barton