This should work, however it only adds one capability and I have not figured out how loop it correctly to add more than one capability...
#!/usr/bin/perl
use strict;
use NaServer;
use Getopt::Long;
use WFAUtil;
my $array;
my $vfiler;
my $rolename;
my $comment;
my $capabilities;
GetOptions("array=s" => \$array,
"vfiler:s" => \$vfiler,
"rolename:s" => \$rolename,
"comment:s" => \$comment,
"capabilities:s" => \$capabilities
) or die 'Illegal command parameters';
#my @capabilitieslist = split(',', $capabilities);
my $wfaUtil = WFAUtil->new();
$wfaUtil->sendLog('INFO','Connecting to array: '.$array);
my $server = $wfaUtil->connect($array, $vfiler);
my $add = new NaElement('useradmin-role-add');
my $role = new NaElement('useradmin-role');
$add->child_add($role);
my $roleinfo = new NaElement('useradmin-role-info');
$role->child_add($roleinfo);
$roleinfo->child_add_string('comment',$comment,);
$roleinfo->child_add_string('name',$rolename);
my $allowed = new NaElement('allowed-capabilities');
$roleinfo->child_add($allowed);
my $capainfo1 = new NaElement('useradmin-capability-info');
$allowed->child_add($capainfo1);
$capainfo1->child_add_string('name',$capabilities);
$wfaUtil->sendLog('INFO','Creating Role Name : '.$rolename);
my $out = $server->invoke_elem($add);
if ( $out->results_status() eq "failed" )
{
$wfaUtil->sendLog('WARN',"Unable to add role '".$rolename."'. Reason: ".$out->results_reason());
exit(1);
}