#! /usr/bin/perl -T use utf8; use Scalar::Util 'tainted'; use warnings; use strict; binmode(STDOUT, ":utf8"); my @chars = qw(x r Ä a L ö K f Ü r T b u); my @sorted; if (shift) { use locale; @sorted = sort @chars; } else { @sorted = sort @chars; } my $s = "hubert"; my ($res) = $s =~ /(\w)/; die "res is tainted!\n" if tainted($res); print join (' ', @sorted), "\n";