-------------------------------------------------------------------------------- http://en.wikipedia.org/wiki/Morse_code Morse code is a character encoding for transmitting telegraphic information, using standardized sequences of short and long elements to represent the letters, numerals, punctuation and special characters of a given message. The short and long elements can be formed by sounds, marks, or pulses, in on off keying and are commonly known as "dots" and "dashes" or "dits" and "dahs". A .- N -. 1 .---- . .-.-.- B -... O --- 2 ..--- , --..-- C -.-. P .--. 3 ...-- ? ..--.. D -.. Q --.- 4 ....- ( -.--. E . R .-. 5 ..... ) -.--.- F ..-. S ... 6 -.... - -....- G --. T - 7 --... " .-..-. H .... U ..- 8 ---.. _ ..--.- I .. V ...- 9 ----. ' .----. J .--- W .-- 0 ----- : ---... K -.- X -..- / -..-. ; -.-.-. L .-.. Y -.-- + .-.-. $ ...-..- M -- Z --.. = -...- -------------------------------------------------------------------------------- Write a program that translates a text file into morse code, and can also translate a morse code file back into text. perl morse.pl encode original.txt morse.txt perl morse.pl unencode morse.txt output.txt There should be no difference between the original and the unencoded output produced by the program, except that case should be folded to upper case. Given the following input (original.txt): -------------------------------------------------------------------------------- This is my string Samuel -------------------------------------------------------------------------------- And run as: perl morse.pl encode original.txt morse.txt The program should produce something like the following morse-code file: -------------------------------------------------------------------------------- -, ...., .., ..., , .., ..., , --, -.--, , ..., -, .-., .., -., --., , ..., .-, --, ..-, ., .-.., , -------------------------------------------------------------------------------- Then, when run as: perl morse.pl unencode morse.txt output.txt It should produce the input (as upper case): -------------------------------------------------------------------------------- THIS IS MY STRING SAMUEL --------------------------------------------------------------------------------