use strict; use warnings; use feature 'say'; use Data::Dumper; use MyClient; my $client = MyClient->new; my $list = $client->call('ListCustomers'); $list->parse_json_payload; say sprintf 'Start: Found %d accounts.', $list->payload->{totalCount}; my %results; for my $account ( @{ $list->payload->{items} } ) { my $id = $account->{id}; say "Deleting $id"; my $call = $client->call('DeleteCustomer', { account_id => $id }); say 'Status: ' . $call->status; $call->status == 204 ? $results{OK}++ : $results{NOT_OK}++; } say 'Results: ' . Dumper \%results; __END__