But this is one possible way:
# mapping from format-name to formatID my %clipboard_formats = map { $cb->GetFormatName($_) => $_ } $cb->EnumFormats();
(Note: this only gets formats that are available in the current clipboard. So use this to check whether a format is available.)