use open IO => ":utf8"; while (<>) { my @layers = PerlIO::get_layers(\*ARGV); say "(@layers)"; }