in reply to speed issues

This has nothing to do with your speed issue, but I thought I'd offer a less cluttered version of your sub gen_reportfile_name:
sub gen_reportfile_name { my ($mday, $mon, $year) = (localtime)[3,4,5]; $reportfile = sprintf '/dirhere/%4d%02d%02dtalkpath', $year+1900, +$mon+1, $mday; }

This uses an array slice to extract only the elements of interest from the list returned by localtime.