That runs for a bit but then ends with "500 Internal Server Error at test.pl line 212" (test.pl being what I pasted your script as). It'll list about 10 entries before dying (though it says it's retrieving 20).
Then the following gets printed to /var/log/httpd/httpd_errors:
Nov 1 14:53:26 bigip02 fcgi-[17233]: [warn] FastCGI: server "/usr/local/www/iControl/iControlPortal.cgi" (pid 21348) terminated due to uncaught signal '11' (Segmentation fault)
Nov 1 14:53:26 bigip02 fcgi-[17233]: [warn] FastCGI: server "/usr/local/www/iControl/iControlPortal.cgi" has remained running for more than 30 seconds, its restart interval has been restored to 5 seconds
Nov 1 14:53:26 bigip02 fcgi-[17233]: [warn] FastCGI: server "/usr/local/www/iControl/iControlPortal.cgi" restarted (pid 21511)
Nov 1 14:53:26 bigip02 httpd[6174]: [error] [client 10.1.1.78] FastCGI: incomplete headers (0 bytes) received from server "/usr/local/www/iControl/iControlPortal.cgi"