use Test::More 'no_plan'; my $escaped = 'st\x{f9}'; my $bytes = "st\x{f9}"; ok( $escaped ne $bytes, '$escaped ne $bytes' ); my $unescaped = $escaped; $unescaped =~ s{ \\x\{ ([a-f0-9]{2}) \} }{ chr hex $1 }xmseg; is( $unescaped, $bytes, '$unescaped eq $bytes' );