Richard, I have tried your script and I am getting the following error:

Script error: expected expression!
$iIndex=ascan($asAcceptable,$sKeyValue)