use Unicode::String qw( latin1 utf8 ); while ( <> ) { print utf8( $_ )->latin1; }