#!/usr/bin/perl -- use Path::Tiny qw/ path /; use Data::Dump qw/ dd /; my $infile = 'three-lines-unicode.xml'; my $outfile = 'three-lines-uniWHAT.xml'; dd( path( $infile )->slurp_utf8 ); getTwiggy( $infile , $outfile ); dd( path( $outfile )->slurp_raw ); sub getTwiggy { ## minimal demo of Twig not what you want } __END__