in reply to Unknown PerlIO layer "encoding" when it should fail because it's tainted

I was able to reduce the code even more:
#!/usr/bin/perl -T use strict; use warnings; use FindBin; my $whereami = $FindBin::Bin; open my $fh, '<:encoding(UTF-8)', $whereami or die;

Note that untainting $whereami before opening the file prevents the error:

$whereami =~ /^(.*)$/ and $whereami = $1;

Interestingly, removing the :encoding prevents the error, too, without untainting, which seems wrong.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Unknown PerlIO layer "encoding" when it should fail because it's tainted
by bliako (Abbot) on Feb 09, 2022 at 18:55 UTC

    not for me unless I add use Test::More;