Sample code for 30+ languages & platforms
Perl Requires Chilkat v11.0.0+

Wasabi Delete Bucket Objects

See more Wasabi Examples

Demonstrates how to delete one or more objects in a bucket.

Chilkat Perl Downloads

Perl
use strict;
use warnings;
use Chilkat2;

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

my $http = Chilkat2::Http->new;

# Insert your access key here:
$http->AwsAccessKey('access-key');

# Insert your secret key here:
$http->AwsSecretKey('secret-key');

# Use the endpoint matching the bucket's region.
$http->AwsEndpoint('s3.us-west-1.wasabisys.com');

my $bucketName = 'chilkattest';

my $objectName1 = 'seahorse.jpg';
my $objectName2 = 'seahorse2.jpg';

my $st = Chilkat2::StringTable->new;
$st->Append($objectName1);
$st->Append($objectName2);

my $jsonResp = Chilkat2::JsonObject->new;
my $success = $http->S3_DeleteObjects($bucketName, $st, $jsonResp);
if (!$success) {
    print $http->LastErrorText, "\n";
    exit;
}

print 'Response status code = ', $http->LastStatus, "\n";

# Display the JSON response.
$jsonResp->EmitCompact(0);
print $jsonResp->Emit(), "\n";