Forum Moderators: open
They look like:
href=http://www.widget.com/cgi-bin/CDcart?REF=myrefcode&DEST=/cgi-bin/MySQLdb%3fMYSQL_VIEW%3d/cart/cat/view_my_page.txt
Many forums do this to allow Google to spider content that's normally restricted in some way to humans.
I don't have sample code for you, I don't do perl. Since you are using a perl CGI already, you should post this request in the perl forum [webmasterworld.com]. There are some very helpful folks there. :)
You may also try a site search for "perl user agent detection" with your favorite search engine. (In Google, for example, use "site:webmasterworld.com perl user agent detection")