sub _write_to_file { ^^^^^ my $outfile = $_[0]; my $contents = $_[1]; my $FH; if( ! open $FH, '>:encoding(UTF-8)', $outfile ){ ^^ warn "failed to open file '$outfile' for reading, $!"; ^^^^^^^