If you want to understand why perl is such a good language for processing data have a look at this sample which (someone correct me if im wrong) seems to do what you are trying to do.
Looking into regular expressions (re's) can be very useful but this example is maybe to complex to start from if you are a newbie.
while(<>) {
s/(.)/ (ord($1) <= 0) ? chr(128-(45-ord($1))) : chr(ord($1)-45)/ge;
print;
{
Note: you did say that this was not currently for homework, didn't you?