I am working on a simple search/replace program to replace some characters by another ones in a file.

The program ask the user the substitution he wants to make.

I would like to replace a newline by a tabulation with this program but I never succeeded

If the user enters with the keyboard <\n> as a search character and then <\t> as a replacement character, the newline \n is well recognized by the program, but the tabulation \t is not. As a result, the program replace each newline by the character <\t>.

If in my program, I set : $with = "\t" ; Then the program works perfectly, but I did not found how to enter \t with the keyboard (I tried "\t", '\t', \t ...), nothing work...

I also found a similar solution ; But my solution also have some big limitations. Imagine for exemple that you want to replace a space by "\n"."a_chain_of_characters". "\n" For a simple one character replacement it is ok but for a complex one it does not work.