http://qs321.pair.com?node_id=1204333

topcoder has asked for the wisdom of the Perl Monks concerning the following question:

First off, I'll be honest, I don't know anything about Perl other than it's a powerful language. I'm trying to provide sample code to "Perl" programmers to use an API.

In C# this is the code..
try { string apiKey = "Your Secret Key"; string emailToValidate = "example@example.com"; string responseString = ""; string apiURL = "https://api.zerobounce.net/v1/validate?apikey=" + +apiKey + "&email=" + HttpUtility.UrlEncode(emailToValidate); //Uncomment out to use the optional API with IP Lookup //string apiURL = "https://api.zerobounce.net/v1/validatewithip?api +key=" + apiKey + "&email=" + HttpUility.UrlEncode(emailToValidate); ++ "&ipaddress=" + HttpUtility.UrlEncode("99.123.12.122") HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiURL); request.Timeout = 150000; request.Method = "GET"; using (WebResponse response = request.GetResponse()) { response.GetResponseStream().ReadTimeout = 20000; using (StreamReader ostream = new StreamReader(response.GetRe +sponseStream())) { responseString = ostream.ReadToEnd(); } } } catch (exception ex) { Catch Exception - All errors will be shown here - if there are iss +ues with the API }
How would the above be converted to PERL? I seen a few different examples on the web (Might be out of date), but I don't have an easy way to test things. If some awesome monk can give me the basic syntax and then point me to an online Perl compiler that allows JSON REST Calls, I can probably take it from there.