<Readme> Perl newbie needs help with a hash. Recent Active Dir site has enabled smart card login & need to do a comparison of two arrays to get username/smartcard id to match up. Code looks like this</readme>
@getuser = `dsquery user –name * -o samid –limit 1000`; foreach (@getuser) { $a = $_; chomp $a; $b = (split (/”/, $a))[1]; } @getcert = `dsquery usern –name * -o upn –limit 1000`; foreach (@getcert) { $c = $_; chomp $c; $d = (split (/”/, $c))[1]; $e = (split (/@/, $d))[0]; }
<Readme> Output from array 1(username) is as follows: smithj jonesa johnsonw Output from array 2(smartcard id) is as follows: 1234567 8901234 5678901 Output from both arrays are in same order, so i just need a one for one association (eg, output1 from first array will always = output2 from array2, and so forth), that is output like: smithj = 1234567 jonesa = 8901234 johnsonw = 5678901 Not sure how to associate this - would appreciate any assists</readme>

In reply to Newbie Needs Help with Hash by jorain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.