in reply to Newbie Needs Help with Hash

Here is a modified version of your code that builds a hash allowing lookup either by user or smartcard id. This is assuming $b = user and $e = smartcard id (your variable names don't provide a clue). Since the arrays are 1:1, the for loop is used to generate a common index into both arrays. For your own benefit (code maintenance), please consider:

use strict; use warnings; my %id_lookup; my @getuser = `dsquery user -name * -o samid -limit 1000`; my @getcert = `dsquery usern -name * -o upn -limit 1000`; for (0 .. scalar @getuser -1){ my $a = $getuser[$_]; chomp $a; my $b = (split (/"/, $a))[1]; my $c = $getcert[$_]; chomp $c; my $d = (split (/"/, $c))[1]; my $e = (split (/@/, $d))[0]; $id_lookup{$b} = $e; # this line adds reverse lookup, if desired $id_lookup{$e} = $b; }