Although it is not your primary concern in your question, I would like to comment on the way you extract user name and smart card id from the strings.
You can utilize regexes for the task. The following is a recommendation.
use warnings;
use strict;
my $user_name_regex = qr/
~ # match the first ~
([^~]+) # capture the characters as long as it is not a ~
/x;
my $smartcard_id_regex = qr/
~ # match the first ~
([^~@]+) # capture the characters as long as it is not a ~ or @
/x;
@getuser = `dsquery user –name * -o samid –limit 1000`;
my @user_names = map {
chomp;
$_ =~ $user_name_regex; # match and capture user name
$1 # return the capture;
} @getuser;
@getcert = `dsquery usern –name * -o upn –limit 1000`;
my @smartcard_ids = map {
chomp;
$_ =~ $smartcard_id_regex; # match and capture smartcard id
$1; # return the capture
} @getcert;
Oguz
---------------------------------
life is ...
$mutation = sub { $_[0] =~ s/(.)/rand()<0.1?1-$1:$1/ge };