Могу ли я опустить use 'utf8'
-прагму, когда я уже использую use encoding 'utf8'
?
#!/usr/bin/env perl
use warnings;
use 5.012;
use Encode qw(is_utf8);
use encoding 'utf8';
my %hash = ( '☺' => "☺", '\x{263a}' => "\x{263a}", 'ä' => "ä", 'a' => "a" );
for my $key ( sort keys %hash ) {
say "UTF8 flag is turned on in the STRING $key" if is_utf8( $hash{$key} );
say "UTF8 flag is NOT turned on in the STRING $key" if not is_utf8( $hash{$key} );
}