Docs
Perl Currency Exchange Rate API Documentation

Perl Currency Exchange Rate API Documentation

A comprehensive guide on using our Perl Currency Exchange Rate API for efficient and reliable currency conversion.

Explore how to seamlessly integrate our Currency Exchange Rate API into your Perl projects. Our API provides accurate and reliable exchange rates, making it suitable for both personal and professional applications.

Why Use Our Perl Currency Exchange Rate API?

Our API offers a straightforward approach to fetching exchange rates through simple GET requests. Integration with your Perl project is easy and hassle-free, with no complex dependencies required.

The API delivers fast, JSON-formatted responses that are easy to parse and understand. Perl’s high-performance libraries for handling JSON make it effortless to access and utilize the data.

For comprehensive details on supported request types and features, refer to our Main Documentation.

Quick Start: Perl Currency Conversion Example

To begin, you’ll need to sign up for a free account to obtain your API key. Register here to get your key.

Here’s a simple example demonstrating how to use our API in Perl:

use LWP::UserAgent;
use HTTP::Request;
use JSON;
 
# Making request
my $base_code = "USD";
my $URL = "https://api.currencyexchangerate-api.com/v1/YOUR-API-KEY/latest/".$base_code;
my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 });
my $header = HTTP::Request->new(GET => $URL);
my $request = HTTP::Request->new('GET', $URL, $header);
my $response = $ua->request($request);
my $content = $response->content;
 
# Parsing JSON
$json = JSON->new->allow_nonref;
$decoded = $json->decode( $content );
foreach $to_code (keys %{$decoded->{conversion_rates}}){
   print "Exchange Rate $base_code/$to_code = $decoded->{conversion_rates}->{$to_code}";
}

Sample JSON Response

Here’s a sample JSON response from the API with USD as the base currency code:

{
  "result": "success",
  "base_code": "USD",
  "qouta": 100,
  "remining": 78,
  "conversion_rates": {
    "USD": 1,
    "AED": 3.6725,
    "AFN": 71.3023,
    ...
  }
}

For additional details on request types, error handling, and more, please visit our Main Documentation.

Need Help?

If you have any questions or need further assistance, don’t hesitate to contact us. We’re here to assist you!