My apologies I believe I misunderstood you from the start
When I was developing my code I was running it on a computer on the same network as the server and everything worked fine. But, when I uploaded the code to the hosting service (replacing the local IP with the public IP of the server), it started failing in the part where it connects to the database saying that the server wasn't found.
You can't get from your hosting service (which is where the Perl application resides) back into your SQL server.
I don't believe the issue is port-forwarding; you're going to need to allow port 1433 (or whatever port you forwarded that to) through the firewall back to your SQL Server. Not sure what firewall you're using or if you even have access to it, but it would be some TCP rule that allows in "*", and is routed to your internal SQL Server IP address and the appropriate port.
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience