Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Newbie Needs Help with Hash

by mayaTheCat (Scribe)
on Sep 13, 2007 at 06:44 UTC ( [id://638740]=note: print w/replies, xml ) Need Help??


in reply to Newbie Needs Help with Hash

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 };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://638740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (None)
    As of 2024-04-25 01:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found