Sapling Logo

Grammar Checking in Perl


Perl is a family of high-level interpreted scripting languages, including Perl 5 and Perl 6, which was renamed to Raku. It is popular as a scripting language because of its built-in regular expression and string parsing functionality.

Sapling: AI Writing Assistant

With Sapling, you can add grammar or spell checking functionality to an existing Perl application.

This page demonstrates a quick way to integrate grammar and spell checking functionality into a Perl application using Sapling's API. If you are not looking for a Perl guide, click here for guides for other programming languages.

Sapling does not currently maintain a Perl-specific SDK, but you can access the Sapling Grammar Checking HTTP API using any programming language that supports HTTP POST requests. An example is shown below.

Setup Steps

Perl Grammar Check Quickstart

use Encode qw(encode_utf8);
use HTTP::Request ();
use JSON::MaybeXS qw(encode_json);
use MIME::Base64;

my $url = '';
my $header = ['Content-Type' => 'application/json; charset=UTF-8'];
my $data = {key=> 'API_KEY', text=> 'Lets get started', 'session_id' => "Test Document UUID"};
my $encoded_data = encode_utf8(encode_json($data));
my $r = HTTP::Request->new('POST', $url, $header, $encoded_data);
print $r->responseContent();

Returned result:

          "sentence":"Lets get started!",


Addtional parameters and Sapling's full API documentation can be accessed here: