My question to you perl experts is this: would it be possible to assign a particular result if it doesnt find a match? Would it be better to use something else besides the matching operator? Is there an operator to state if nothing matches? I have a list of users stored in an array called @names(20 names) in this format "MANDERSON/Anderson MikeD|MikeD.Anderson\\". @cdwv_list has a list of 10 names stored with this format "MANDERSON". Here is an example of the code:
for ($j = 0; $j < @cdwv_list; $j++) {
$user_id = $cdwv_list[$j];
foreach $names(@names) {
if ($names =~ $user_id) {
#if match I want it to grab name
$names =~ /\/([\w\s]+)\|/;
$name = $1;
}
#So what do I put here or somewhere else if
#the 1st $name doesnt match any of the 10
#users from @cdwv_list? I tried:
else {
#But it only prints this 10 times
#even thought only 1 name doesnt
#match between the two list
print "Name does not exist\n";
}
}
}
Thanks in advance....
Thomas