#!/usr/bin/env perl
use 5.14.0;
use warnings;
use Net::LDAP::Util qw(escape_filter_value);
# users as arguments or via standard input
chomp(@ARGV = readline *STDIN) unless @ARGV;
print '(|';
for my $user (@ARGV) {
print '(userid=' . escape_filter_value($user) . ')';
}
say ')';
E então algo como
$ sudo yum -y install perl-LDAP
... yum flails wildly here ...
$ perl whatyoucalledtheabovecode foo bar zot
(|(userid=foo)(userid=bar)(userid=zot))
$