This example is based on the code in the library_crud.pl sample file.

This example uses the steps that are described in Listing All Content Libraries.

Note: For a complete and up-to-date version of the sample code, see the vSphere Automation SDK Perl samples at GitHub.
...

# Create client stub for general library functions.
my $library_stub = $my_stub_factory->create_stub(
   'service_name' => 'Com::Vmware::Content::Library',
   'stub_config'  => $my_stub_config
);

# List content libraries.
my @library_ids = $library_stub->list();
foreach my $id (@library_ids) {
  my $library = $library_stub->get('library_id' => $id);
  my $name = $library->get_name();
  print "Library ID $id: $name";
}

...