s/\w/\-/g
where \w refers to any 'word' character (alphanumeric including underscore).
$ cat test.txt
I managed to get my text converted to hyphens but now I realise the script needs to have an extra subtlety. When it converts my chosen text to hyphens it needs to leave in from the passage of English all the commas, colons, semi-colons, full stops, etc. Basically any punctuation mark. Is it possible you could show how to do that?
$ perl -pi -e 's/\w/\-/g' test.txt
$ cat test.txt
- ------- -- --- -- ---- --------- -- ------- --- --- - ------- --- ------ ----- -- ---- -- ----- --------. ---- -- -------- -- ------ ---- -- ------- -- ----- -- ----- -- ---- --- ------- -- ------- --- --- ------, ------, -----------, ---- -----, ---. --------- --- ----------- ----. -- -- -------- --- ----- ---- --- -- -- ----?
Note: The above regexp will only match alphanumeric. You'll have to add more individual characters like brackets, curly braces, etc. There is no special regexp in perl for a "non-punctuation" character.
So, the above might be expanded further to,
s/\w|\[|\]|\{|\}/\-/g
which will match any "word" character, any [, any ], any {, or any }. But obviously, you'll have to expand this further to include things like ampersand (&), dollar sign ($), so the regexp might get quite long.
Then again, you could try a reverse replace, but one-line perl'ing that will get quite ugly.