You need the
uc (upercase) and
lc (lowercase) functions, and a conditional statement such as "if".
This smells a bit like homework, so I'll leave you to work the rest out for yourself.
Update: actually, you're probably better off with the transliteration operator (tr). This one didn't occur to me straight off as I rarely use it myself. See perlop for details. Also, if you want to edit the file without opening it, then you'll be interested in the 'i' and 'p' command line switches - see perlrun for details on these.