#!/usr/bin/perl use strict; use warnings; my $utf8="\xe9"; open STDOUT, ">>:utf8", 'test.txt' or die $!; print "No close: ",$utf8,"\n"; close STDOUT; open STDOUT, ">>:utf8", 'test.txt' or die $!; print "Close: ",$utf8,"\n"; PRINTS: No close: \xe9 (not literally - prints character \xe9, not UTF-8 encoded) Close: é