This is one way of doing it, values in @code_array are the accounts in its original format, values in @code_array_noletter are the values from @code_array without the letters at the beginning of the account number since this table is numeric. My objective is, remove the letters from the beginning of the code from the account numbers that of course has letters at the beginning, its done. Second go to this database table find if any of this account numbers are in there and bring the results back which will include the ID, done I can go in there find what I want. Now after I find the match by the number of the account only i need to reattach the code back, like if one of my result will be "2222987" and its ID is "66", at the end I would like to be able to print TMW2222987 (original format) and its ID 66. I hope I made it a little clear this time. Thanks!