I'm taking in search values to make up a file system. When I take the $search in I want to add that to an array. The problem is when I want to only add it if it is not already present. Right now it just keeps on adding it to the array rather than only if it is new. Any help is appreciated.
unless (@AJmasterNAMES =~ /$AJsearch/g) {
push @AJmasterNAMES, "$AJsearch\n";
print AJMASTERNAMES "@AJmasterNAMES";
}
unless (@AJmasterNAMES =~ /$AJsearch/g) {
push @AJmasterNAMES, "$AJsearch\n";
print AJMASTERNAMES "@AJmasterNAMES";
}