For example, to convert a string from Perl's internal format to iso-8859-1 (also known as Latin1), $octets = encode("iso-8859-1", $string);