in reply to
What is wrong here (Replacing Strin pieces)
Do you want to replace all the dashes, or only those at the beginning and at the end of the string?
For replacing all dashes, the tr/// function will be better (and much faster).
In the other case (only the dashes at the beginning and at the end), then you'll need to count the number of dashes you will be removing to figure out how many questions marks to insert, which can be done in several different ways (remember that s/// returns the number of substitutions performed), but none of those I can think of in the moment is really elegant.