in reply to How to save in UTF Mode
This also works for other encodings.
See also perluniintro, perlunicode and Encodings, Unicode and Perl.
(Update: fixed reading/writing direction in the open mode, thanks to ikegami++).