in reply to A question about CGI-Perl
One possible explanation is that API::get_test_run($input) is returning a reference to an empty array, which means it would never enter the loop. Maybe because you call it twice? I would start by testing the return value.