use warnings; use v5.10; use utf8; #-- prototype to setup a block where STDOUT is UTF-8 sub with_utf(&) { open(my $stdout, ">&STDOUT"); #-- STDERR analogue local *STDOUT = $stdout; binmode(*STDOUT, ':encoding(UTF-8)'); shift->(); } my $utf8 = "\x{3bc}\x{1fc6}\x{3bd}\x{3b9}\x{3bd}"; say "Default: $utf8"; # Wide character in say at 1048755.pl line 16. with_utf { say "Lexical: $utf8"; # (no warning) }; say "Default: $utf8"; # Wide character in say at 1048755.pl line 22.