in reply to Replace an asterisk '*" with the content of array

One thing that I notice right away is that you are substituting $_ back into itself, instead of storing the result into a different my variable.   The first time you substitute-away the asterisk ... it is gone.