When we use escape sequences \L and \U in series we get the syntax error message:
perl -E 'say "\L\UXsdf"'
syntax error at -e line 1, near "\L\U"
Execution of -e aborted due to compilation errors.
I think it isn't a syntax error and the code above should work.
If the code shouldn't work nevertheless then the error message should be fixed.
(v5.28.1)