This looks surprisingly like another question asked here yesterday. Homework assignment?
As for the questions ...
- To "undef a variable", you simply undef $foo;. The rest of your first question indicates that you don't really understand what you're asking. Think about it further - what exactly do you want to do? If you don't know, then nothing I say can help you.
- Swapping a character for another character is called transliteration. Perl uses an operator called tr. Click on the hyperlink for more information.
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.