use strict; use warnings; use Test::More qw( no_plan ); my $ch = chr(0xE9); # lowercase e acute # Byte semantics utf8::downgrade($ch); ok( $ch !~ /\w/ ); ok( $ch =~ /\W/ ); ok( $ch !~ /[\w]/ ); ok( $ch =~ /[\W]/ ); # Unicode semantics utf8::upgrade($ch); ok( $ch =~ /\w/ ); ok( $ch !~ /\W/ ); ok( $ch =~ /[\w]/ ); # Should fail according to the docs. ok( $ch !~ /[\W]/ ); # Should fail according to the docs.