in reply to I need to get this code to perl

Sure, here you go, perlfaq, perlintro, DBI, CGI, LWP